Questions tagged [pg8000]

pg8000 is one of many Pure-Python PostgreSQL interfaces for the Python programming language.

pg8000 is one of many PostgreSQL interfaces for the Python programming language. It is written entirely in and does not rely on any external libraries (such as a compiled python module, or ’s library). It is DB-API 2.0 compatible Pure-Python interface to the PostgreSQL database engine.

pg8000’s name comes from the belief that it is probably about the 8000th PostgreSQL interface for Python. pg8000 is distributed under the terms of a modified BSD license.

PLease use this tag if your query is related to the use of pg8000 or its implementation.

62 questions
1
vote
3 answers

How to fix "module 'pg8000' has no attribute 'connect'" error in AWS Glue job

I'm trying to set up a daily AWS Glue job that loads data into a RDS PostgreSQL DB. But I need to truncate my tables before loading data into them, since those jobs work on the whole dataset. To do this, I'm implementing the solution given here:…
1
vote
1 answer

How to avoid byte quoted column headers when reading redshift data with pg8000

I'm loading some redshift data in pandas via pg8000: >>>> df = pd.read_sql(sql_text, pg8000_cnx) pg8000_cnx is a connection object to a redshift database. I always get columns that are byte quoted, ex: >>> df.columns Index([b'column_', …
Gaurav
  • 1,095
  • 10
  • 19
1
vote
1 answer

pg8000.core.ProgrammingError: 'could not determine data type of parameter $2'

I'm using pg.8000 (Postgres) and trying to run the following SELECT query cursor.execute( """ SELECT orders.name, orders.order_price, orders.selling_price, orders.earnings FROM member, orders WHERE…
dukabrat
  • 35
  • 1
  • 1
  • 4
1
vote
1 answer

Redshift insert values into table

I'm trying to load data that is the result of a Python 2.7 library - pg8000 query against a AWS Redshift table. First I query a Redshift table for results and it provides them inside a tuple containing values in a list. Example: value_tuple =…
Fernando
  • 429
  • 6
  • 16
1
vote
1 answer

python flask cursors.execute() of INSERT and DELETE doesn't work

I'm new to python development and I am trying to update a database with the following function, but sadly it doesn't work: def db_update_favourite(user_id, id_layer,favourite): connection = g.db cursor = connection.cursor() …
Jibbo
  • 442
  • 3
  • 13
1
vote
0 answers

Socket error in pg8000 script

I'm using pg8000 to interact with a postgresql database in a python script. I keep getting an error like the following, though not at the same line every time: Traceback (most recent call last): File…
pjshap
  • 72
  • 11
1
vote
2 answers

pg8000 and cursor.fetchall() failing to return records if the number of records is moderate

I'm using the adaptor pg8000 to read in records in my db with the following code: cursor = conn.cursor() results = cursor.execute("SELECT * from data_" + country + " WHERE date >= %s AND date <= %s AND time >= %s AND time <= %s",…
disruptive
  • 5,687
  • 15
  • 71
  • 135
1
vote
1 answer

Connection issue with postgres and pg8000 python - clear password issue?

I'm trying to connect using: conn = DBAPI.connect(host='sql2', user='XXX', password='XX', database='XX', socket_timeout=100, port=100) I now find I get the following error: pg8000.errors.InterfaceError: Authentication method 3 not supported by…
disruptive
  • 5,687
  • 15
  • 71
  • 135
1
vote
1 answer

pg8000 postgres connection issues from python

I'm having trouble connecting to a db on a new system. The version of Python is the same. Here is the connection string for the DB that is there and you'll see the error message change, but I cannot work out why when the connection string is correct…
disruptive
  • 5,687
  • 15
  • 71
  • 135
1
vote
1 answer
0
votes
1 answer

Google CloudSQL Postgres instance database INSERT not working from AWS Lambda, however the SELECT works

The service account auth, database username/pwd for connecting cloudSQL all works, the SELECT statement execution works as well, but strangely the INSERT does not work with no clues, no error, no exception. Need an expert advice here. Update: The…
0
votes
1 answer

AWS --extra-py-files throwing ModuleNotFoundError: No module named 'pg8000'

I am trying to use pg8000 in my Glue Script, following are params in Glue Job --extra-py-files s3://mybucket/pg8000libs.zip //NOTE: my zip contains __init__.py Some Insights towards code import sys import os from awsglue.transforms import…
noobie-php
  • 6,817
  • 15
  • 54
  • 101
0
votes
1 answer

Using SQLAlchemy to execute an SQL statement with named parameters

Why can't I raw insert a list of dicts with SQLalchemy ? import os import sqlalchemy import pandas as pd def connect_unix_socket() -> sqlalchemy.engine: db_user = os.environ["DB_USER"] db_pass = os.environ["DB_PASS"] db_name =…
IndiaSke
  • 348
  • 1
  • 2
  • 10
0
votes
1 answer

API calls to my server fail randomly [FastAPI]

My usual response time is <50ms. Here's my tech: Web Server: FastAPI+uvicorn Proxy: nginx DB: Postgres on VM DB API: sqlalchemy+pg8000 There are two docker containers (~1GB) running on the VM. However, the request wouldn't reach the server, and…
0
votes
1 answer

How to pass NULLs in array to Postgres stored procedure using pg8000?

In Python 3.8 I'm using pg8000 1.21.3 to call a Postgress 11 stored procedure which takes as an argument a custom data type array. Here is the working proof of concept schema and stored procedure: DROP PROCEDURE IF EXISTS myproc; DROP TABLE IF…
Javide
  • 2,477
  • 5
  • 45
  • 61