Skip to content

Instantly share code, notes, and snippets.

@mjpieters
Created October 3, 2014 14:56
Show Gist options
  • Save mjpieters/ddc8ea0a3dc41e07810e to your computer and use it in GitHub Desktop.
Save mjpieters/ddc8ea0a3dc41e07810e to your computer and use it in GitHub Desktop.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> cursor = conn.cursor()
>>> cursor.execute('CREATE TABLE demo (foo PRIMARY KEY, bar INTEGER, spam TEXT, eggs INTEGER NOT NULL DEFAULT 0)')
<sqlite3.Cursor object at 0x1048c43b0>
>>> cursor.execute('PRAGMA table_info(demo)')
<sqlite3.Cursor object at 0x1048c43b0>
>>> [r[1] for r in cursor]
[u'foo', u'bar', u'spam', u'eggs']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment