banner ad

PyPyODBC 0.9.2 released

| February 5, 2013 | 0 Comments
0 Flares 0 Flares ×

Pypyodbc is a pure Python ODBC interface module. How to use the pypyodbc.
pypyodbc

import pypyodbc
pypyodbc.win_create_mdb('D:\\database.mdb')
connection_string = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\database.mdb'
connection = pypyodbc.connect(connection_string)
SQL = 'CREATE TABLE saleout (id COUNTER PRIMARY KEY,product_name VARCHAR(25))'
connection.cursor().execute(SQL)
...

If you have a PyODBC script, you want to try PyPyODBC, you need to comment out the line of code, and add another line of code, like this:

#import pyodbc
import pypyodbc as pyodbc

Through pypyodbc module to get a connected to salesdb.mdb database :

>>> conn = pypyodbc.connect ('Driver = {Microsoft Access Driver (*. mdb)}; DBQ = D: \ \ salesdb.mdb')

And from this connection object operation get cursor of this database:

>>> cur = conn.cursor ()
Download PDF
0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 LinkedIn 0 Reddit 0 StumbleUpon 0 0 Flares ×

Tags: ,

Category: Database

About the Author ()

My name is John Link.I am 26 years old. My major is Computer science and technology. I am a junior programmer with Python.

Leave a Reply

Your email address will not be published. Required fields are marked *

0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 LinkedIn 0 Reddit 0 StumbleUpon 0 0 Flares ×