Skip to content

Commit

Permalink
fix(workflow): re order files to execute
Browse files Browse the repository at this point in the history
  • Loading branch information
danimarinBG committed Aug 2, 2024
1 parent 6fec8ca commit 557448a
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions test/execute_sql_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def connect_to_db():

def main(project_type):
print(f"Project type: {project_type}")

conn = connect_to_db()

# Define the root directories to process
root_directories = ["utils", f"{project_type}", "i18n/en_US"]
root_directories = ["utils/ddl", f"{project_type}/schema_model", "utils/fct", "utils/ftrg", f"{project_type}/fct", f"{project_type}/ftrg", "i18n/en_US"]
exclude_prefix = "ud_" if project_type == "ws" else "ws_"

# Execute SQL files in the root directories
Expand All @@ -63,19 +63,6 @@ def main(project_type):
else:
print(f"Directory {updates_dir} does not exist")

# Execute child views
execute_sql_file(conn, f"childviews/en_US/{project_type}_schema_model.sql")

# Execute last process command
with conn.cursor() as cursor:
lastprocess_command = f"""
SELECT {project_type}_36.gw_fct_admin_schema_lastprocess(
'{{"client":{{"device":4, "lang":"en_US"}}, "data":{{"isNewProject":"TRUE", "gwVersion":"3.6.012", "projectType":"{project_type.upper()}", "epsg":25831, "descript":"{project_type}_36", "name":"{project_type}_36", "author":"postgres", "date":"29-07-2024"}}}}'
);
"""
cursor.execute(lastprocess_command)
conn.commit()

# Define the example directory
example_dir = f"example/user/{project_type}"

Expand All @@ -89,6 +76,16 @@ def main(project_type):
else:
print(f"Directory {example_dir} does not exist")

# Execute last process command
with conn.cursor() as cursor:
lastprocess_command = f"""
SELECT {project_type}_36.gw_fct_admin_schema_lastprocess(
'{{"client":{{"device":4, "lang":"en_US"}}, "data":{{"isNewProject":"TRUE", "gwVersion":"3.6.012", "projectType":"{project_type.upper()}", "epsg":25831, "descript":"{project_type}_36", "name":"{project_type}_36", "author":"postgres", "date":"29-07-2024"}}}}'
);
"""
cursor.execute(lastprocess_command)
conn.commit()

# Close the database connection
conn.close()

Expand Down

0 comments on commit 557448a

Please sign in to comment.