-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcsv_to_sql_query.py
More file actions
33 lines (23 loc) · 887 Bytes
/
csv_to_sql_query.py
File metadata and controls
33 lines (23 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 19 07:55:51 2022
@author: eneemann
"""
import os
import time
import pandas as pd
# Start timer and print start time in UTC
start_time = time.time()
readable_start = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())
print("The script start time is {}".format(readable_start))
work_dir =r'C:\Users\eneemann\Documents\ArcGIS\Projects\DABC\Licensees_20220810'
csv = os.path.join(work_dir, 'correct_tab.csv')
correct = pd.read_csv(csv)
correct_list = correct['license_no'].to_list()
SQL = f"""LICENSE_NO IN ('{"','".join([(str(item)) for item in correct_list])}')"""
print(SQL)
print("Script shutting down ...")
# Stop timer and print end time in UTC
readable_end = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime())
print("The script end time is {}".format(readable_end))
print("Time elapsed: {:.2f}s".format(time.time() - start_time))