Questions tagged [pygresql]

PyGreSQL is the oldest open-source Python module that interfaces to a PostgreSQL database. It runs on most platforms where PostgreSQL and Python are running.

The current version PyGreSQL 5.0+ needs PostgreSQL 9.0 or newer and Python 2.6, 2.7 or 3.3+.

See the docs at http://www.pygresql.org/

48 questions
0
votes
1 answer

{InternalError}ERROR: Assert false - Invalid type: 705

based on https://pygresql.readthedocs.io/en/latest/contents/pg/adaptation.html sql = "SELECT * FROM user_table WHERE login = %s AND passwd = %s" db.query_formatted(sql, (login, passwd)).getresult()[0] I reused this snippet of code to try to use…
Vzzarr
  • 4,600
  • 2
  • 43
  • 80
0
votes
1 answer

ModuleNotFoundError: No module named 'pg'

After trying to use pg library in Python as just as import pg I get this error message: Traceback (most recent call last): File "", line 1, in module = self._system_import(name, *args, **kwargs) ModuleNotFoundError: No module…
Vzzarr
  • 4,600
  • 2
  • 43
  • 80
0
votes
1 answer

PyGreSQL AWS Glue Python

I'm trying to use the PyGreSQL package in AWS Glue with a Python job. I have uploaded to a S3 bucket the wheel file from here: https://pypi.org/project/PyGreSQL/#files the 3.6 for x64 then in the job I use: import pg with this configuration I get…
user2728349
  • 139
  • 1
  • 3
  • 12
0
votes
2 answers

How to execute parallel queries with PyGreSQL?

I am trying to run multiple queries in parallel with PyGreSQL and multiprocessing, but below code hangs without returning: from pg import DB from multiprocessing import Pool from functools import partial def create_query(table_name): return…
Randomize
  • 8,651
  • 18
  • 78
  • 133
0
votes
0 answers

PyGreSQL/pg hangs when connecting to DB over SSH tunnel

In my Python script, I want to be able to connect to a Postgres DB via an SSH tunnel. I'm using sshtunnel package to create a tunnel, and using PyGreSQL to connect to the DB. When I try to establish the database connection, the pg.connect call just…
mrsinister
  • 97
  • 2
  • 7
0
votes
2 answers

AWS Glue Python Shell script timing out

I am trying to connect to and read an on-premise data source using an AWS Glue Python Shell job. I am using Pygresql (which comes bundled on Glue) and Pandas. Everything works locally. But when I push this job up to Glue, the database connections…
0
votes
1 answer

how does a Python api database connection work?

I am starting to try an work with databases using Python. I am trying to understand the process when I connect to a database and get some data out of it. I think it works like this: The Python code is used by the Python Api to access the Database…
onno
  • 969
  • 5
  • 9
0
votes
0 answers

pygresql - insufficient data in "T" message

I've caught a problem I can't explain using pygresql for python. This is a simple SELECT query and as far as I can tell the only query that has the problem in the whole script. Exception in thread Thread-3: Traceback (most recent call last): File…
Dan
  • 1,812
  • 3
  • 13
  • 27
0
votes
2 answers

Python: Installing pygresql

I am trying to install PyGreSQL module on my computer using pip. It shows this message: Collecting pygresql Using cached PyGreSQL-5.0.3-cp35-cp35m-win_amd64.whl Installing collected packages: pygresql Successfully installed…
0
votes
2 answers

How to update Python PygreSQL package on Linux Debian?

I have Linux Debian installed. In debian repository the newest stable version of PygreSQL is 4.0 The newest version of PygreSQL is 5.0.2 but I don't see debian in thier site: http://www.pygresql.org/download/index.html What should I do?
ban
  • 187
  • 1
  • 1
  • 10
0
votes
1 answer

copy LONGTEXT from MySQL to CITEXT in PostgreSQL using Python

I have data in MySQL table which I want to copy to a PostgreSQL table. Everything works except when the MySQL contains a string with " and/or ' For example: The data in MySQL: When I run my code I get: ProgrammingError: ERROR: syntax error at or…
ban
  • 187
  • 1
  • 1
  • 10
0
votes
2 answers

OperationalError: not enough arguments for format string

I'm running the following code: #converts strings that are ints to int. for i,x in enumerate(values): try: values[i] = int(x) except: pass # Fills values with NULLs if needed if len(values) < no_of_columns: values =…
Sahand
  • 7,980
  • 23
  • 69
  • 137
0
votes
1 answer

How to not have pgdb add quotes

I'm doing an SQL insterface, and I'm having a problem with string formatting. What I want to do is an SQL INSERT INTO table_name statement. When I do it now, using parameterized instertion, I get unwanted quotes around my table name. This is the…
Sahand
  • 7,980
  • 23
  • 69
  • 137
0
votes
1 answer

python sql interval

With PostgreSQL, one of my tables has an 'interval' column, values of which I would like to extract as something I can manipulate (datetime.timedelta?); however I am using PyGreSQL which seems to be returning intervals as strings, which is less than…
Ellery Newcomer
  • 1,594
  • 1
  • 11
  • 23
0
votes
1 answer

PyGreSQL NULLs for integer field

I am trying to insert some rows into a table which has a field of integers, which can be NULL: cur.execute("INSERT INTO mytable (id, priority) VALUES (%(id)d, %(priority)d)", \ {'id': id, 'priority': priority}) The priority variable is…
James
  • 815
  • 1
  • 8
  • 6