psycopg Questions

3

Solved

I'm a beginner at python. We use this code to execute SQL commands. cur.execute("INSERT INTO test (num, data) VALUES (%s, %s)", (100, "abcdef")) I wonder is this prepared statement or just a cli...
Ruysdael asked 26/3, 2012 at 3:45

2

Solved

This might be a rather silly question but what am I doing wrong here? It creates the table but the INSERT INTO doesn't work, I guess I'm doing something wrong with the placeholders? conn = psycopg...
Childlike asked 7/10, 2013 at 22:11

3

Solved

I use psycopg2 to connect to PostgreSQL on Python and I want to use connection pooling. I don't know what should I do instead commit() and rollback() when I execute INSERT query. db = pool.Simple...
Funderburk asked 14/4, 2015 at 7:29

1

Solved

I have the following postgreSql table stock, there the structure is following with column insert_time has a default value now() | column | pk | type | +-------------+-----+-----------+ | id | yes ...
Lunetta asked 25/7, 2018 at 14:59

2

Solved

What would be the equivalent of psycopg's cur.mogrify on mysql? From: http://initd.org/psycopg/docs/cursor.html mogrify(operation[, parameters]) Return a query string after arguments binding. ...
Jackshaft asked 15/1, 2014 at 12:36

1

Solved

I have a pretty simple snippet of Python code to run a Postgres query then send the results to a dashboard. I'm using psycopg2 to periodically run the same query. Let's not worry about the looping ...
Expunge asked 17/7, 2017 at 23:38

1

Solved

So I am building a query based on user input in flask with this code: if empty_indic_form.validate_on_submit(): query='select name, year, value, display_name from literal inner join ent on ent_i...
Outlying asked 29/6, 2016 at 4:58

1

I have an application that parses and loads data from csv files into a Postgres 9.3 database. In serial execution insert statements/cursor executions work without an issue. I added celery in the m...
Kovacev asked 14/5, 2015 at 16:2

4

Solved

This string: "CREATE USER %s PASSWORD %s", (user, pw) always gets expanded to: CREATE USER E'someuser' PASSWORD E'somepassword' Can anyone tell me why? Edit: The expanded string above is the...
Hirsh asked 1/8, 2010 at 13:40

3

Solved

The psycopg docs state: "Psycopg connections are not green thread safe and can’t be used concurrently by different green threads. Trying to execute more than one command at time using one cursor pe...
Sohn asked 29/9, 2012 at 4:53

4

I am currently analyzing a wikipedia dump file; I am extracting a bunch of data from it using python and persisting it into a PostgreSQL db. I am always trying to make things go faster for this fil...
Firewarden asked 28/12, 2008 at 17:51

3

I'm populating a PostgreSQL table with ~11.000.000 rows that have been selected before from another database. I'm using Python and psycopg2. The whole process takes an estimated 1.5 hours to comple...
Determiner asked 23/2, 2011 at 10:45

3

Solved

I have a piece of Python code, that interacts with a PostgreSQL database via psycopg. All literature warns against doing sql formatting by oneself, and recommends letting the driver do it. E.g.: ...
Over asked 21/7, 2011 at 11:47
1

© 2022 - 2024 — McMap. All rights reserved.