in pyodbc how do you get a single table from database as an object
I've struggled through documentation and I don't really know how to get a single table from Database via pyodbc.
I know how to access table and开发者_StackOverflow中文版 all the values, but is there way to get a table as an object?
I tried this, but it doesn't seem nice (although it works):
conn=pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};DBQ=D:\\inkom\\makenet.mdb')
DB=conn.cursor()
Single_Table=DB.execute('SELECT * FROM Table_Name')
isn't there easier way like DB.getTable('Name')
?
Cheers
you can always use cursor.tables(table=tablename, catalog=, schema=, tableType=)
you should read through the wiki: http://code.google.com/p/pyodbc/wiki/Cursor
精彩评论