[Python-Dev] Convert Sqlite Function from cx_Oracle
Oleg Broytman
phd at phdru.name
Mon Oct 30 16:45:01 EDT 2017
More information about the Python-Dev mailing list
Mon Oct 30 16:45:01 EDT 2017
- Previous message (by thread): [Python-Dev] Convert Sqlite Function from cx_Oracle
- Next message (by thread): [Python-Dev] The syntax of replacement fields in format strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello. This mailing list is to work on developing Python (adding new features to Python itself and fixing bugs); if you're having problems learning, understanding or using Python, please find another forum. Probably python-list/comp.lang.python mailing list/news group is the best place; there are Python developers who participate in it; you may get a faster, and probably more complete, answer there. See http://www.python.org/community/ for other lists/news groups/fora. Thank you for understanding. On Mon, Oct 30, 2017 at 05:41:20PM -0200, Carlos Eugenio <cedugenio at gmail.com> wrote: > ============================================================== > SQLITE3 Function > > def get_db(): > def dict_factory(cursor, row): > d = {} > for idx, col in enumerate(cursor.description): > d[col[0]] = row[idx] > return d > > db = getattr(g, '_database', None) > if db is None: > db = g._database = sqlite3.connect(DATABASE) > db.row_factory = dict_factory > return db > ================================================================ > > I try this form but isnt ok . Can I help me ? > > > import cx_Oracle > con = cx_Oracle.connect('xxxx/xxxx at xxxxxxx/xxxxxxx') > > cur = con.cursor() > cur.execute("select * from test") > > desc = [d[0] for d in cur.description] > > result = [dict(zip(dec,line))for line in cur] > > print (result) > > cur.close() > > -- > Carlos Eug??nio Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN.
- Previous message (by thread): [Python-Dev] Convert Sqlite Function from cx_Oracle
- Next message (by thread): [Python-Dev] The syntax of replacement fields in format strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list