File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 1818 f"dbname={ dbname } user={ user } password={ password } host={ host } " ,
1919 port = port
2020 )
21- query = "SELECT * FROM store;"
21+ query = """
22+ SELECT * FROM store
23+ """
2224 cursor = conn .cursor ()
2325 cursor .execute (query )
2426 results = cursor .fetchall ()
2527 print (results )
2628
27- with open ("products .csv" , "w" ) as f :
29+ with open ("stores .csv" , "w" ) as f :
2830 writer = csv .writer (f )
2931 columns = [(
30- "UPC" ,
31- "DESCRIPTION" ,
32- "MANUFACTURER" ,
33- "CATEGORY" ,
34- "SUB_CATEGORY" ,
35- "PRODUCT_SIZE" ,
32+ "STORE_ID" ,
33+ "STORE_NAME" ,
34+ "ADDRESS_CITY_NAME" ,
35+ "ADDRESS_STATE_PROV_CODE" ,
36+ "MSA_CODE" ,
37+ "SEG_VALUE_NAME" ,
38+ "PARKING_SPACE_QTY" ,
39+ "SALES_AREA_SIZE_NUM" ,
40+ "AVG_WEEKLY_BASKETS" ,
3641 )]
3742 writer .writerows (columns )
3843 writer .writerows (results )
You can’t perform that action at this time.
0 commit comments