¡@

Home 

python Programming Glossary: curs

How do I do database transactions with psycopg2/python db api?

http://stackoverflow.com/questions/1219326/how-do-i-do-database-transactions-with-psycopg2-python-db-api

do db.begin # possible even set the isolation level here curs db.cursor cursor.execute 'select etc... for update' ... cursor.execute.. # possible even set the isolation level here curs db.cursor cursor.execute 'select etc... for update' ... cursor.execute.. possible even set the isolation level here curs db.cursor cursor.execute 'select etc... for update' ... cursor.execute 'update..

Recreating Postgres COPY directly in Python?

http://stackoverflow.com/questions/1869973/recreating-postgres-copy-directly-in-python

this question If you're using the psycopg2 driver the cursors provide a copy_to and copy_from function that can read from.. is from the copy_from.py example conn psycopg2.connect DSN curs conn.cursor curs.execute CREATE TABLE test_copy fld1 text fld2.. copy_from.py example conn psycopg2.connect DSN curs conn.cursor curs.execute CREATE TABLE test_copy fld1 text fld2 text fld3..

Query crashes MS Access

http://stackoverflow.com/questions/3064830/query-crashes-ms-access

conn pyodbc.connect 'DRIVER s DBQ s PWD s' DRV MDB PWD curs conn.cursor SQL 'SELECT FROM mytable ' # insert your query here.. 'DRIVER s DBQ s PWD s' DRV MDB PWD curs conn.cursor SQL 'SELECT FROM mytable ' # insert your query here curs.execute.. SQL 'SELECT FROM mytable ' # insert your query here curs.execute SQL rows curs.fetchall curs.close conn.close # you could..

How can I make cx-oracle bind the results of a query to a dictionary rather than a tuple?

http://stackoverflow.com/questions/4468071/how-can-i-make-cx-oracle-bind-the-results-of-a-query-to-a-dictionary-rather-than

host 1521 sid orcl cx_Oracle.connect 'scott tiger@' dsn curs orcl.cursor sql select from sometable curs.execute sql result.. sid orcl cx_Oracle.connect 'scott tiger@' dsn curs orcl.cursor sql select from sometable curs.execute sql result curs.fetchall.. tiger@' dsn curs orcl.cursor sql select from sometable curs.execute sql result curs.fetchall for row in result print row..

Use binary COPY table FROM with psycopg2

http://stackoverflow.com/questions/8144002/use-binary-copy-table-from-with-psycopg2

StringIO conn psycopg2.connect dbname mydb user postgres curs conn.cursor # Convert floating point numbers to text write to.. conn psycopg2.connect dbname mydb user postgres curs conn.cursor # Convert floating point numbers to text write to COPY input.. converts text back to floating point numbers cpy.seek 0 curs.copy_from cpy 'num_data' columns 'node' 'ts' 'val1' 'val2' conn.commit..