Questions tagged [psycopg]

Psycopg is a popular PostgreSQL adapter for the Python programming language. At its core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

59 questions
0
votes
2 answers

How to get list using sql query in python?

I am defining a function here and making a query. def fetch(temp_pass,temp_accno): cur.execute('''SELECT id, name, acc_no, ph_no,address, email,balance FROM accounts WHERE id = %s and acc_no = %s''', …
Eish Ahuja
  • 21
  • 3
0
votes
0 answers

SQL Insert Into Postgres With Psycopg2 ExecuteValues

I am simply trying to insert a new row into an existing Postgres database with the Python Psycopg2 module's executeValues function. I am using this because in the future I will need to do a batch insert, but for now I am only testing one row. Here…
0
votes
1 answer

Is there a register_adapter (found in psycopg) equivalent function in asyncpg

Do we have to register adapters in asyncpg for executing queries, just like in psycopg? http://initd.org/psycopg/docs/extensions.html#psycopg2.extensions.register_adapter
Atihska
  • 4,803
  • 10
  • 56
  • 98
0
votes
1 answer

No module named psycopg2 even after i installed psycopg2

I have #!/usr/bin/python3 import psycopg2 in my first couple lines of the code. However, it shows that ImportError: No module named psycopg2 even after I install psycopg2 Below is the detail errors from the ternimal. 432p1:/vagrant> pip3…
overloading
  • 145
  • 9
0
votes
1 answer

Query a Postgress table using a large python list and Psycopg2 with speed.?

I have a python list of upwards of 2000 elements. I have a postgress table i need to query for each one of these elements, i am currently using the following. cur.execute("SELECT * FROM patent_info WHERE patentno = ANY (%s);",…
Sheikebab
  • 11
  • 1
0
votes
1 answer

python script keeps converting dates to utc

I have the following: import psycopg2 from openpyxl import Workbook wb = Workbook() wb.active =0 ws = wb.active ws.title = "Repair" ws.sheet_properties.tabColor = "CCFFCC" print(wb.sheetnames) import datetime import smtplib import…
cocopan
  • 109
  • 3
  • 19
0
votes
1 answer

Can't connect to postgres on centos with psycopg

I've downloaded postgres on centos, created a database, created a user with a password, restarted postgres, checked the user in pg_authid, done it again, and I still can't connect. Why can't I connect? postgres=# create database test; CREATE…
Alexander Kleinhans
  • 5,950
  • 10
  • 55
  • 111
0
votes
1 answer

psycopg for python 3? Unable to find vcvarsall.bat error

I'm trying to install psycopg on my computer; I have Python3.5 and PostgreSQL9.5.3 installed. I get the error Unable to find vcvarsall.bat error when typing python setup.py build on cmd. Having read some answers, it appeared to me, that the 3rd…
parsecer
  • 4,758
  • 13
  • 71
  • 140
0
votes
1 answer

Psycopg2 under osx works on commandline but fails in Aptana studio

I have been developing under Python/Snowleopard happily for the part 6 months. I just upgraded Python to 2.6.5 and a whole bunch of libraries, including psycopg2 and Turbogears. I can start up tg-admin and run some queries with no problems.…
dave
  • 1,567
  • 2
  • 21
  • 34
0
votes
1 answer

Put date in filename postgres with psycopg in a python script

I am streaming tweets to a postgres database with a python script (using psycopg2). I would like to be able to schedule this script in a windows task manager. The only issue I have to overcome is to be able to rename the table in postgres. Is it…
Zuenie
  • 963
  • 2
  • 11
  • 30
0
votes
1 answer

How to Python PostgreSQL INSERT IF NOT EXIST?

I have a python script that is using the Psycopg adapter; I am parsing a JSON Array and inserting into my PostgreSQL database. for item in data["SchoolJSONData"]: mId = item.get("Id") mNumofRooms = item.get("NumofRooms") mFloors =…
Bajan
  • 634
  • 3
  • 12
  • 30
0
votes
1 answer

API started, db killed, db started, peewee.InterfaceError connection already closed

Starting app.py, then killing the database and hitting /api/foo gives me: peewee.OperationalError: could not connect to server: Connection refused Bringing the database back up gives me and hitting /api/foo gives me: peewee.OperationalError:…
A T
  • 13,008
  • 21
  • 97
  • 158
0
votes
0 answers

Django and jython-standalone

I am pretty new to Django and Jython. I am trying to create war file which can be deployed to Jboss server. Unfortunately I have a problem with psycopg2 library. I am using the modjy servlet so my library are placed in lib-python folder under…
Jaroslaw.zawila
  • 509
  • 2
  • 4
  • 14
0
votes
1 answer

manage.py syncdb fails on Windows 7

I am trying to build my first Django app but I can't get the database to sync properly in the initial attempt. I get the following error: c:\mysite>manage.py syncdb Traceback (most recent call last): File "C:\mysite\manage.py", line 10, in…
Tsahi Levent-Levi
  • 2,351
  • 2
  • 18
  • 26
1 2 3
4