I'm trying to write a class in order to create an sqlite table since I have to create quite a few tables for this assignment.
This is how I tried to approach:
def connect_database(database_name):
table_connect = lite.connect(database_name)
print "connected successfully"
return table_connect
def create_table(name_of_table, *argument_name, *argument_type):
# create_user = user_table.cursor()
# create_user.execute("Drop table if EXISTS user_table")
# create_user.execute('create table user_table(user_id INT, user_name VARCHAR )')
# create_user.close()
table_create = name_of_table.cursor()
table_create.execute("drop table if exists name_of_table")
table_create.execute('''
create table name_of_table(
argument_name argument_type
argument_name name_of_table
)
''')
print "create table successfully"
table_create.close()
example = connect_database('example.db')
create_table(example, water, FLOAT)
The problems I have is not being able to pass multiple argument_names, or pass argument_type in the method.
Also, the program returns unresolved reference for water and FLOAT.
Is there anyway that I can finish the method?
Thanks
{}button after selecting it