Questions tagged [pgdb]

20 questions
6
votes
1 answer

How to use pgdb.executemany?

I'm trying to execute insert statements from Python to PostgreSQL using the pgdb module. I see the documentation says: cursor.executemany(query, list of params) # Execute a query many times, binding each param dictionary # from the…
Eric Wilson
  • 51,818
  • 71
  • 192
  • 262
5
votes
2 answers

Installing pgdb: pg_config tool is not available

So here is my goal: To get a .py file that imports pgdb, to run. For this, as far as I have understood, I need PygreSql. I have both postgresql 9.4.4 and python 2.7.9 installed (Postgresql with source code and python with the normal download form…
Sahand
  • 6,046
  • 14
  • 51
  • 105
4
votes
1 answer

pg.InternalError: SSL SYSCALL error: EOF detected

I have a code in python using multiprocessing and accessing a database. It works most of the time properly but from time to time it creates an error. The error was originally File "/usr/lib/python2.7/multiprocessing/pool.py", line 528, in get …
Antonin
  • 1,521
  • 6
  • 16
  • 24
2
votes
2 answers

python pgdb hanging database

I'm writing a script to access data in an established database and unfortunately, I'm breaking the DB. I'm able to recreate the issue from the command line: [user@box tmp]# python Python 2.7.2 (default, Sep 19 2011, 15:02:41) [GCC…
fredsnertz
  • 383
  • 1
  • 3
  • 6
2
votes
1 answer

python insert to postgres over psycopg2 unicode characters

Hi guys I am having a problem with inserting utf-8 unicode character to my database. The unicode that I get from my form is u'AJDUK MARKO\u010d'. Next step is to decode it to utf-8. value.encode('utf-8') then I get a string 'AJDUK…
HateCamel
  • 23
  • 1
  • 6
1
vote
0 answers

Unable to insert data insert data in postgres table using pgdb

I am trying to insert some values in a postgres table in a python script using pgdb. At first I tried this: cursor.execute('INSERT INTO sites (url) VALUES (%s)', (i,)) This did not work so I changed it to print 'INSERT INTO sites (url) VALUES…
Ravi
  • 687
  • 3
  • 16
1
vote
1 answer

Does pgdb prevent against injection attacks?

I have a piece of code like this: db = pgdb.connect( database=connection['database'], user=connection['user'], host=connection['host']) cursor = db.cursor() # ask database query = ''' SELECT a, b, c FROM table WHERE a ILIKE…
Ann Kilzer
  • 1,146
  • 1
  • 13
  • 36
0
votes
2 answers

Creating a user login function for a database in SQL using Python, pgdb, PostgreSQL

I have an SQL database that I access using Python and pgdb. I plan on opening access to a group of users, so I would like to incorporate a login function that takes in a username and password that is checked against the database's information on…
Captain Murphy
  • 815
  • 3
  • 15
  • 23
0
votes
0 answers

Setting TLS version to a specific version for connecting to Postgres Database through pgdb module

I am trying to test a feature of the Postgres DB of limiting tls version between a min and a max version. The specific test I am writing checks if a client which strictly uses tlsv1.1 cannot connect to a Postgres server limited to only using…
imtj1990
  • 43
  • 5
0
votes
1 answer

AttributeError: 'module' object has no attribute 'connect' in the pgdb module using python

import pgdb myConnection = pgdb.connect( host=hostname, user=username, password=password, database=database ) doQuery( myConnection ) myConnection.close() I get the following error when i run the script. >>> AttributeError: 'module'…
sham sar
  • 5
  • 4
0
votes
0 answers

Right way to pass SQL to pgdb in python

Using pgdb connection I am passing SQL to get results into a DF which are further processed. As the module grows, python class (queries.py below) that keeps track of all the SQL is growing longer and longer. Any suggestions how to handle it as it…
SaM
  • 43
  • 6
0
votes
1 answer

pgdb import error (_pd.pyd file not created)

Facing the same issue as ver.2 PyGreSQL ERROR: from _pg import * ImportError: DLL load failed: The specified module could not be found, but in this case I can see that _pg.pyd file is not created in the site packages of the virtual environment.…
0
votes
0 answers

Error with using PyGreSQL. pg.DatabaseError: Last query did not return tuples

I use pgdb(PyGreSQL) in my project to connect to the working DB. I wrote generator to fetch rows with the pagination from huge tables. # DbHelper.py ... def GetMultipleRowsGenerator(self, query, page_size=None): """Execute a query and return…
Stan Zeez
  • 1,040
  • 2
  • 14
  • 32
0
votes
0 answers

OperationalError: Can't start transaction Postgresql

I am running pgdb.connect to make a connection to my postgresql server and cursor to execute queries. For the first time (sometimes twice) it works properly but after that it gives me OperationalError: Can't start transaction on…
bazinga
  • 1,610
  • 2
  • 17
  • 32
0
votes
1 answer

How to receive notices with PyGreSQL?

I'm using PyGreSQL 4.1.1 with Postgres 9.5, and have written some stored functions. I use RAISE with different levels inside of the functions for debugging purposes, which works very well in psql, but I haven't found a way to access those messages…
clemens
  • 14,173
  • 11
  • 38
  • 52
1
2