Skip to content
Snippets Groups Projects

Migrate Build to UV

Merged Kevin Dietz requested to merge migrate-to-uv into main
Files
9
``` python
``` python
# THIS CELL MUST REMAIN AS THE FIRST CELL OF THE NOTEBOOK
# THIS CELL MUST REMAIN AS THE FIRST CELL OF THE NOTEBOOK
# This cell is tagged `parameters` for papermill.
# This cell is tagged `parameters` for papermill.
# Click the gears on the right side of JupyterLab and make sure the parameters tag is set for this (and only this) cell
# Click the gears on the right side of JupyterLab and make sure the parameters tag is set for this (and only this) cell
is_local_development = True
%% Cell type:markdown id:247c80e9-554b-495f-84fe-3c153d6c5dce tags:
%% Cell type:markdown id:247c80e9-554b-495f-84fe-3c153d6c5dce tags:
from sklearn.impute import IterativeImputer
from sklearn.impute import IterativeImputer
 
%% Cell type:code id:02dd195e-634c-47b7-bbbb-8fe04cb9da3f tags:
 
``` python
 
# Set Working Dir and Data Dir
 
original_cwd = os.getcwd()
 
 
#If running in CI, we need to change the working directory to where our notebook is running -- `notebooks/`
 
if os.getenv("GITLAB_CI"):
 
os.chdir(notebook_dir)
 
os.getcwd()
 
 
print(os.getcwd())
%% Cell type:markdown id:a7beed93-0bea-422a-9563-0360079dd8c1 tags:
%% Cell type:markdown id:a7beed93-0bea-422a-9563-0360079dd8c1 tags:
%% Cell type:code id:259aed7f-9a29-43a1-bc45-8429924ff2f0 tags:
%% Cell type:code id:781f4b51-44a2-4252-839e-62d78d513d32 tags:
``` python
``` python
if is_local_development:
# Initalize Snowflake Connection
 
if os.getenv("GITLAB_CI"):
 
snowflake_engine = snowflake_engine_factory(env, "DATA_SCIENCE_LOADER", run_target='ci')
 
raw_db_name = env["SNOWFLAKE_LOAD_DATABASE"]
 
prod_db_name = env["SNOWFLAKE_PROD_DATABASE"]
 
 
else:
snowflake_engine = data_science_engine_factory(env, profile_target='dev', run_target='local')
snowflake_engine = data_science_engine_factory(env, profile_target='dev', run_target='local')
# please fill in the analytics branch here to connect to the correct DB
# please fill in the analytics branch here to connect to the correct DB
branch_name = ""
branch_name = ""
raw_db_name = f"{branch_name.upper()}_RAW"
raw_db_name = f"{branch_name.upper()}_RAW"
prod_db_name = f"{branch_name.upper()}_PROD"
prod_db_name = f"{branch_name.upper()}_PROD"
# prep_db_name = f"{branch_name.upper()}_PREP"
else:
snowflake_engine = snowflake_engine_factory(env, "DATA_SCIENCE_LOADER", run_target='ci')
raw_db_name = env["SNOWFLAKE_LOAD_DATABASE"]
prod_db_name = env["SNOWFLAKE_PROD_DATABASE"]
snowflake_engine
snowflake_engine
 
%% Cell type:code id:9ac5309e-2ce9-4511-846a-cf206d70f8bb tags:
 
``` python
# Run Query
# Run Query
with open(my_query_name) as file:
with open(my_query_name) as file:
query = file.read()
query = file.read()
Loading