I'd like to create a function makeTable to create a sqlite table from a python class. I have this class:
class Foo(object):
def __init__(self):
self.a
self.b
self.c
I tried defining the function in this way:
def makeTable(obj):
conn = sqlite3.connect(sqlfilename)
cursor = conn.cursor()
cursor.execute(sqlString)
But I have to create the sqlString such as:
"""CREATE TABLE foo (a text, b text)"""
How can I create this sqlString automatically from a given class?
ORMfor Object Relational Mapping a tool that does what you expect ;)