소스 검색

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):
 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()
     conn.commit()
     print('Databse entries have been added. New table:')
     print('Databse entries have been added. New table:')
     for row in c.execute("select * from aircraft"):
     for row in c.execute("select * from aircraft"):
@@ -126,4 +127,4 @@ def csvtodbtails(to_db):
     print('Databse entries have been added. New table:')
     print('Databse entries have been added. New table:')
     for row in c.execute("select * from tails"):
     for row in c.execute("select * from tails"):
         print(row)
         print(row)
-    conn.close()
+    conn.close()