diff --git a/dbt_ext/extension.py b/dbt_ext/extension.py index b42600c..b47b694 100644 --- a/dbt_ext/extension.py +++ b/dbt_ext/extension.py @@ -14,10 +14,12 @@ from meltano.edk.process import Invoker, log_subprocess_error from meltano.edk.types import ExecArg +from . import files + try: - from importlib.resources import files as ir_files + from importlib import resources except ImportError: - from importlib_resources import files as ir_files + import importlib_resources as resources log = structlog.get_logger() @@ -130,7 +132,9 @@ def initialize(self, force: bool = False) -> None: log.info("creating dbt project directory", path=self.dbt_project_dir) self.dbt_project_dir.mkdir(parents=True, exist_ok=True) - for entry in ir_files("files_dbt_ext.bundle.transform").iterdir(): + files_dir = resources.files(files) + + for entry in files_dir.joinpath("bundle", "transform").iterdir(): if entry.name == "__pycache__": continue log.debug(f"deploying {entry.name}", entry=entry, dst=self.dbt_project_dir) @@ -145,7 +149,7 @@ def initialize(self, force: bool = False) -> None: log.info("creating dbt profiles directory", path=self.dbt_profiles_dir) self.dbt_profiles_dir.mkdir(parents=True, exist_ok=True) - for entry in ir_files("files_dbt_ext.profiles").iterdir(): + for entry in files_dir.joinpath("profiles").iterdir(): if entry.name == self.dbt_ext_type and entry.is_dir(): log.debug( f"deploying {entry.name} profile", diff --git a/files_dbt_ext/bundle/transform/models/.gitkeep b/dbt_ext/files/__init__.py similarity index 100% rename from files_dbt_ext/bundle/transform/models/.gitkeep rename to dbt_ext/files/__init__.py diff --git a/files_dbt_ext/bundle/transform/.gitignore b/dbt_ext/files/bundle/transform/.gitignore similarity index 100% rename from files_dbt_ext/bundle/transform/.gitignore rename to dbt_ext/files/bundle/transform/.gitignore diff --git a/files_dbt_ext/bundle/transform/dbt_project.yml b/dbt_ext/files/bundle/transform/dbt_project.yml similarity index 100% rename from files_dbt_ext/bundle/transform/dbt_project.yml rename to dbt_ext/files/bundle/transform/dbt_project.yml diff --git a/dbt_ext/files/bundle/transform/models/.gitkeep b/dbt_ext/files/bundle/transform/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/files_dbt_ext/profiles/athena/profiles.yml b/dbt_ext/files/profiles/athena/profiles.yml similarity index 100% rename from files_dbt_ext/profiles/athena/profiles.yml rename to dbt_ext/files/profiles/athena/profiles.yml diff --git a/files_dbt_ext/profiles/bigquery/profiles.yaml b/dbt_ext/files/profiles/bigquery/profiles.yaml similarity index 100% rename from files_dbt_ext/profiles/bigquery/profiles.yaml rename to dbt_ext/files/profiles/bigquery/profiles.yaml diff --git a/files_dbt_ext/profiles/duckdb/profiles.yml b/dbt_ext/files/profiles/duckdb/profiles.yml similarity index 100% rename from files_dbt_ext/profiles/duckdb/profiles.yml rename to dbt_ext/files/profiles/duckdb/profiles.yml diff --git a/files_dbt_ext/profiles/postgres/profiles.yml b/dbt_ext/files/profiles/postgres/profiles.yml similarity index 100% rename from files_dbt_ext/profiles/postgres/profiles.yml rename to dbt_ext/files/profiles/postgres/profiles.yml diff --git a/files_dbt_ext/profiles/redshift/profiles.yml b/dbt_ext/files/profiles/redshift/profiles.yml similarity index 100% rename from files_dbt_ext/profiles/redshift/profiles.yml rename to dbt_ext/files/profiles/redshift/profiles.yml diff --git a/files_dbt_ext/profiles/snowflake/profiles.yml b/dbt_ext/files/profiles/snowflake/profiles.yml similarity index 100% rename from files_dbt_ext/profiles/snowflake/profiles.yml rename to dbt_ext/files/profiles/snowflake/profiles.yml