Skip to content

Commit a8fd3b4

Browse files
committed
Update 1_load_source_data.py
1 parent 38d6e2b commit a8fd3b4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

1_load_source_data.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,18 @@ def main():
8989
if not os.path.exists(dir_sql_processed):
9090
os.makedirs(dir_sql_processed)
9191
# ---------------------------------------------------------
92+
# If database does not exist, create database
93+
# ---------------------------------------------------------
94+
(ret, exist) = mapping_util.does_db_exist(db_conf)
95+
if exist == False:
96+
ret = mapping_util.create_db(db_conf)
97+
if ret == True:
98+
# ---------------------------------------------------------
9299
# Create the schemas
93100
# ---------------------------------------------------------
94-
fname = dir_sql + '1__schema_create.sql'
95-
print('Calling ' + fname + ' ...')
96-
ret = mapping_util.execute_sql_file_parallel(db_conf, fname, False)
101+
fname = dir_sql + '1__schema_create.sql'
102+
print('Calling ' + fname + ' ...')
103+
ret = mapping_util.execute_sql_file_parallel(db_conf, fname, False)
97104
if ret == True:
98105
# ---------------------------------------------------------
99106
# Ask the user for DROP confirmation

0 commit comments

Comments
 (0)