tags:

views:

65

answers:

2

How to use any SQL database eg. mysql, pgsql or other except the ones Python has built-in support for?

def example():
  con= Mysql("root", blablabla)
  con->query("SELECT * bla bla bla")
....
+3  A: 

What DB and what extension are you using? For sqlite3 (and any other extension compatible with DB-API 2.0) you can use something like this:

conn = sqlite3.connect('/tmp/example')
c = conn.cursor()

# Create table
c.execute('''create table stocks(date text, trans text, symbol text, qty real, price real)''')

# Insert a row of data
c.execute("""insert into stocks values ('2006-01-05','BUY','RHAT',100,35.14)""")

# Save (commit) the changes
conn.commit()

# We can also close the cursor if we are done with it
c.close()

BTW, there is no ->in Python

Yassin
A: 

There is a list of Python 3.x compatible packages here: http://pypi.python.org/pypi?:action=browse&c=533&show=all

All I could find was oursql and py-postgresql

jonescb