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

Fixing package requirements and repackaging dbt #46

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a162bfa
updating required packages
rachelannelise Dec 18, 2020
58c13dd
upgrading requirements
rachelannelise Dec 18, 2020
f993218
reorg for package consistency
rachelannelise Dec 18, 2020
ffaff7f
pinning requirements
rachelannelise Dec 18, 2020
d769990
pinning requirements
rachelannelise Dec 18, 2020
f44ffa9
pinning requirements
rachelannelise Dec 18, 2020
bfe0a5a
adding file pathlib for yaml merge
rachelannelise Dec 18, 2020
94783d2
updating relative path location
rachelannelise Dec 18, 2020
ac2c964
updating relative path location
rachelannelise Dec 18, 2020
a87ee8b
updating relative path location
rachelannelise Dec 18, 2020
5125b61
include dbt_project file yaml
hbbtstar Dec 19, 2020
9848311
change merge_settings to use pkg_resources
hbbtstar Dec 19, 2020
abe15ed
adding dbt to package data
rachelannelise Dec 21, 2020
a1f863d
adding more pkg resources
rachelannelise Dec 21, 2020
9191cb4
adding more pkg resources
rachelannelise Dec 21, 2020
b332505
adding more pkg resources
rachelannelise Dec 21, 2020
f2a4c20
adding profile to args
rachelannelise Dec 21, 2020
0f02e8f
adding all files in dbt to manifest
rachelannelise Dec 21, 2020
fa74fac
adding models to manifest
rachelannelise Dec 21, 2020
d39966b
adding dbt models to manifest
rachelannelise Dec 21, 2020
f0107f6
adding dbt models to manifest
rachelannelise Dec 21, 2020
5567c4d
adding init to require install
rachelannelise Dec 21, 2020
6db0be0
adding init to require install
rachelannelise Dec 21, 2020
756386f
adding init to require install
rachelannelise Dec 21, 2020
f8ccc93
removing init and adding package data
rachelannelise Dec 21, 2020
aa70df4
adding all package data files
rachelannelise Dec 21, 2020
d2c7318
adding all package data files
rachelannelise Dec 21, 2020
0562b97
adding all package data files
rachelannelise Dec 21, 2020
4c2622a
adding all package data files
rachelannelise Dec 21, 2020
5fbccef
trying manifest
rachelannelise Dec 21, 2020
ae30517
trying manifest
rachelannelise Dec 21, 2020
b645eef
trying manifest
rachelannelise Dec 21, 2020
6d4f0da
trying manifest
rachelannelise Dec 21, 2020
c3513b2
removing package_data
rachelannelise Dec 21, 2020
f406e49
changing dbt requirements
rachelannelise Jan 11, 2021
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
Prev Previous commit
Next Next commit
adding profile to args
  • Loading branch information
rachelannelise committed Dec 21, 2020
commit f2a4c20410ce6aa1f1e3649f5c8ef36ef655445a
4 changes: 3 additions & 1 deletion parsely_raw_data/dbt/redshift/redshift_etl.py
Original file line number Diff line number Diff line change
@@ -96,14 +96,16 @@ def main():
help='The last day to process data from S3 to Redshift in the format YYYY-MM-DD')
parser.add_argument('--dbt_profiles_dir', required=False, default=DBT_PROFILE_LOCATION,
help='The location from root that contains the .dbt/profiles.yml file, example: /home/user/.dbt/')
parser.add_argument('--dbt_profile', required=False, default='parsely_dwh',
help='The name of the dbt profile located in the local /.dbt/profiles.yml file')
parser.add_argument('--dbt_target', required=False, default=DBT_PROFILE_TARGET_NAME,
help='The target ie. dev, prod, or test to use within the dbt profiles.yml file.')
parser.add_argument('--create-table', action='store_true', default=True,
help='Optional: create the Redshift Parse.ly rawdata table because it does not yet exist.')
args = parser.parse_args()

# Reset dbt_profile to any updated settings:
settings_migration = migrate_settings()
settings_migration = migrate_settings(profile=args.dbt_profile)
if not settings_migration:
logging.warning("Settings not copied to dbt_profiles.yml successfully.")
raise Exception("Settings not copied to dbt_profiles.yml successfully. Please edit default.py or copy the"
4 changes: 2 additions & 2 deletions parsely_raw_data/dbt/redshift/settings/merge_settings_yaml.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
from .default import *

SETTINGS_VAR_MAPPING = [
{'location': 'profile', 'settings': DBT_PROFILE_NAME},
{'location': 'parsely:events', 'settings': PARSELY_RAW_DATA_TABLE},
{'location': 'parsely:timezone', 'settings': ETL_TIME_ZONE},
{'location': 'parsely:actions', 'settings': ETL_PARSELY_ACTIONS},
@@ -22,9 +21,10 @@
]


def migrate_settings():
def migrate_settings(profile=DBT_PROFILE_NAME):
# because this is a package resource, have to reference it with pkg_resources
filepath = pkg_resources.resource_filename("parsely_raw_data", "dbt/redshift/dbt_project.yml")
SETTINGS_VAR_MAPPING.append({'location': 'profile', 'settings': profile})

with open(filepath) as file:
dbt_profile = yaml.load(file, Loader=yaml.FullLoader)