浏览代码

edited csv to aircraft table function

Felix Turowsky 4 年之前
父节点
当前提交
6c82de6efa
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      dbpopulation/csvimport.py

+ 3 - 2
dbpopulation/csvimport.py

@@ -104,7 +104,8 @@ with open(os.path.join('./csv', 'aircraft.csv')) as fin:  # imports flights
 
 
 def csvtodbac(to_db):
-    c.executemany("INSERT INTO aircraft (Name, icao, iata) VALUES (?, ?, ?);", to_db)
+    
+    c.executemany("INSERT INTO aircraft (aircraft_id,make,model,variant,name,iata,icao,singlepilot,multipilot,singleengine,multiengine,turboprop,jet,heavy) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", to_db)
     conn.commit()
     print('Databse entries have been added. New table:')
     for row in c.execute("select * from aircraft"):
@@ -126,4 +127,4 @@ def csvtodbtails(to_db):
     print('Databse entries have been added. New table:')
     for row in c.execute("select * from tails"):
         print(row)
-    conn.close()
+    conn.close()