pg8000

pg8000 Can't Parameterize Queries

℡╲_俬逩灬. 提交于 2020-01-06 08:38:30
问题 I've been trying to use pg8000 to interact with my SQL server, but for some reason, it won't accept params properly. It does seem to recognize the paramstyle, and then knows to change those to the PostgreSQL params, but it never seems to pass the params through. I looked at the documentation example here (link) for examples, and they didn't work. Here are some examples: query = """ SELECT * FROM schema.table_name """ conn = pg8000.connect(**credential_dict) cursor = conn.cursor() cursor

AttributeError: 'UUID' object has no attribute 'replace' when using backend-agnostic GUID type

人盡茶涼 提交于 2019-12-10 03:14:58
问题 I want to have a primary key id with type uuid in a Postgresql database using SQLAlchemy 1.1.5, connecting to the database with the pg8000 adapter. I used the Backend-agnostic GUID Type recipe from the SQLAlchemy documentation. When I want to insert into the database, I get the following error File ".../guid.py", line ???, in process_result_value return uuid.UUID(value) File "/usr/lib/python2.7/uuid.py", line 131, in __init__ hex = hex.replace('urn:', '').replace('uuid:', '') AttributeError:

How do I connect to Postgresql using SSL from SqlAchemy+pg8000?

落爺英雄遲暮 提交于 2019-11-29 16:14:42
Connecting to postgres via pg8000 from SqlAlchemy worked fine until I enabled SSL on postgres. db = create_engine('postgresql+pg8000://user:pass@hostname/dbname', echo=True).connect() Now it seems to fail with: File "/Library/Python/2.7/site-packages/pg8000/core.py", line 872, in __init__ raise InterfaceError("communication error", exc_info()[1]) sqlalchemy.exc.InterfaceError: (InterfaceError) ('communication error', error(61, 'Connection refused')) None None probably you need to add connect_args dict: db = create_engine('postgresql+pg8000://user:pass@hostname/dbname', connect_args={'sslmode':

How do I connect to Postgresql using SSL from SqlAchemy+pg8000?

白昼怎懂夜的黑 提交于 2019-11-28 10:00:44
问题 Connecting to postgres via pg8000 from SqlAlchemy worked fine until I enabled SSL on postgres. db = create_engine('postgresql+pg8000://user:pass@hostname/dbname', echo=True).connect() Now it seems to fail with: File "/Library/Python/2.7/site-packages/pg8000/core.py", line 872, in __init__ raise InterfaceError("communication error", exc_info()[1]) sqlalchemy.exc.InterfaceError: (InterfaceError) ('communication error', error(61, 'Connection refused')) None None 回答1: probably you need to add