Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

40 dont close connections between operations #41

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions dbt_automation/operations/flattenairbyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ def flatten_operation(config: dict, warehouse, project_dir: str):
# finally write the yml with the models configuration
dbtproject.write_model_config(DEST_SCHEMA, models, logger=logger)

# close the client
warehouse.close()


# ================================================================================
def mk_dbtmodel(warehouse, sourcename: str, srctablename: str, columntuples: list):
Expand Down
2 changes: 0 additions & 2 deletions dbt_automation/operations/syncsources.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ def sync_sources(config, warehouse, project_dir):
yaml.safe_dump(merged_definitions, outfile, sort_keys=False)
logger.info("wrote source definitions to %s", sources_file)

warehouse.close()


if __name__ == "__main__":
load_dotenv("dbconnection.env")
Expand Down
2 changes: 2 additions & 0 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@
config=config, warehouse=warehouse, project_dir=project_dir
)
logger.info(f"finished running the {op_type} operation")

warehouse.close()
3 changes: 1 addition & 2 deletions scripts/scaffolddbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@

flatten_json_target = Path(project_dir) / "macros" / "flatten_json.sql"
custom_schema_target = Path(project_dir) / "macros" / "generate_schema_name.sql"
shutil.copy("assets/flatten_json.sql", flatten_json_target)
logger.info("created %s", flatten_json_target)
shutil.copy("assets/generate_schema_name.sql", custom_schema_target)
shutil.copy("dbt_automation/assets/generate_schema_name.sql", custom_schema_target)
logger.info("created %s", custom_schema_target)

dbtproject_filename = Path(project_dir) / "dbt_project.yml"
Expand Down