I am running sqlite3 and I can not, because in my life it shows what is wrong with my code Used to be. Keeping in mind that while creating another table before the database does not do the accident, I suspect it might be a case of capitalization on a SQL statement, but it was usually working a few days back.
Create a table function
Db: cursor = db.cursor () cursor.execute ("Choose sqlite_master name where name =?", (Table_name,)) as def createtable (db_name, table_name, sql): sqlite3.connect (db_name) result = cursor.fetchl () keep_table = true if LAN (results) == 1: response = input ( "Table {0} already exists, do you want to restore (y / n):" .format (table_name)) # response feedback == 'Y': kept _table = wrong printed ("{0} table again - All existing data will be lost ". Format (table_name) cursor.secute ("drop table if {0}" format (table_name) is present) db.commit () elif response == 'n': print ("current table was placed") Else: print ("Wrong input, please try again") #validation measure if len (result) == 1: response = input ("table {0} already exists, do you want to restore (y / n):" .format (table_name)) If response == 'y': keep_table = false print ("{0} table will be rebuilt - all existing data will be lost" .format (table_name)) Curse R.exicute ("drop table if exists {0}". Format (table_name)) db.commit () Other: kept_table = if not wrong: cursor Execute (SQL) db.commit ()
Tables which are causing the problem?
def create_customer_table (): sql = "" "Create Table Customer (ClientIIT Integer, Firstname Lesson, Last Name Text, Street Text, Town Text), Postcode Text, Telephone Number Text Ignore the fact that it is not dentistic, it is my email address text primary key (customer ID), "" "" (DB_name, "customer", SKL)
Program (Order ID) Foreign Key (Customer ID) Reference Customer (Customer ID) Customer ID (Order ID Integer, Customer ID Integer, Date Date, Time Integrated Primary Key (Order ID) Foreign Key (Customer ID)
Here I have an error:
traceback (most recent call final) "" _ _ _ _ _ _: file "/ user / x / download / manageable_marg_015.py", line 110, in & lt; module & gt; Create_customer_table ) File "/ user / x / download / management_market_mark_015.py", line 78, create_customer_table create_table (db_n) (": Syntax Error:
)," ame "," customer ", sql file," / user / x / downloads / managment_mag_2015.py ", line 33, in the create_table cursor.excute (sql) / Pre>
No comments:
Post a Comment