Title says it all. Anyone have any experience doing this? I’ve tried a few things, but after running the following as a test query:
SELECT pg_typeof(image) FROM table_987654;
The returned type is text
, the values usually being something like '45125'
, which to my eyes looks like a key or pointer of some type. I know Anvil does a lot of awesome magic for us when it comes to Data Tables, so is this just something that isn’t feasible with psycopg2
yet, or is there a way to use this returned value to find my binary data? I figure that I’ll have to change it to a Media
object in python afterwards anyway, so just the binary would be fine.
Also, to clarify, the reason I’m trying to use psycopg2
for this rather than anvil.tables
is because, as I understand it, mixing the two can cause issues with transactions. In this particular app, that may not really be a big deal because I’m probably not going to do a whole lot of writing, so this is mostly academic in nature.
Thanks!
EDIT - I’d also be interested in how you might go about writing a file object to a table with psycopg2
. I haven’t done any research into this portion of the issue, but I had the thought and wanted to append it here.