-
-
Save jordanlewis/d36d6cf455fe2ba64dd51c47112271a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
binary = b'\xff\xd8\xff\xe0\x00\x10' | |
conn = psycopg2.connect('postgresql://root@localhost:26257/test?sslmode=disable') | |
with conn as conn, conn.cursor() as c: | |
c.execute('select %s::BYTEA', (binary, )) | |
rv, = c.fetchone() | |
rv = bytes(rv) | |
print('got', repr(rv), 'expected', repr(binary)) | |
assert rv == binary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment