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

feat(loire-atlantique) : adding Loire-Atlantique dbt project #64

Merged
merged 2 commits into from
Feb 4, 2025
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
46 changes: 46 additions & 0 deletions .github/workflows/loire_atlantique_models_run_preproduction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: loire_atlantique_models_run_preproduction

on:
workflow_dispatch:

env:
DBNAME: ${{ secrets.LOIRE_ATLANTIQUE_DBNAME_PROD }}
HOST_PREPROD: ${{ secrets.HOST_PREPROD }}
PASSWORD_PREPROD: ${{ secrets.PASSWORD_PREPROD }}
PORT_PREPROD: ${{ secrets.PORT_PREPROD }}
TARGET_SCHEMA: ${{ secrets.SCHEMA_PROD }}
USER_PREPROD: ${{ secrets.USER_PREPROD }}
PARTICIPATION_HOST_NAME: ${{ secrets.LOIRE_ATLANTIQUE_PARTICIPATION_HOST_NAME }}
WORKING_DIRECTORY: ./projects/loire_atlantique


jobs:
loire_atlantique_models_run_preproduction:
name: loire_atlantique_models_run_preproduction
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}

steps:
- name: Check out
uses: actions/checkout@master

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12.x"
cache: 'pip'

- name: Install dependencies
run: |
pip install -r requirements.txt
dbt deps --target preprod

- name: Run dbt models
run: dbt run --target preprod

- name: Test dbt models
run: dbt test --target preprod


46 changes: 46 additions & 0 deletions .github/workflows/loire_atlantique_models_run_production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: loire_atlantique_models_run_production

on:
workflow_dispatch:

env:
DBNAME: ${{ secrets.LOIRE_ATLANTIQUE_DBNAME_PROD }}
HOST: ${{ secrets.HOST }}
PASSWORD: ${{ secrets.PASSWORD }}
PORT: ${{ secrets.PORT }}
TARGET_SCHEMA: ${{ secrets.SCHEMA_PROD }}
USER: ${{ secrets.USER }}
PARTICIPATION_HOST_NAME: ${{ secrets.LOIRE_ATLANTIQUE_PARTICIPATION_HOST_NAME }}
WORKING_DIRECTORY: ./projects/loire_atlantique


jobs:
loire_atlantique_models_run:
name: loire_atlantique_models_run_production
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}

steps:
- name: Check out
uses: actions/checkout@master

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12.x"
cache: 'pip'

- name: Install dependencies
run: |
pip install -r requirements.txt
dbt deps --target prod

- name: Run dbt models
run: dbt run --target prod

- name: Test dbt models
run: dbt test --target prod


4 changes: 4 additions & 0 deletions projects/loire_atlantique/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

target/
dbt_packages/
logs/
15 changes: 15 additions & 0 deletions projects/loire_atlantique/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Welcome to your new dbt project!

### Using the starter project

Try running the following commands:
- dbt run
- dbt test


### Resources:
- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction)
- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers
- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support
- Find [dbt events](https://events.getdbt.com) near you
- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices
Empty file.
3 changes: 3 additions & 0 deletions projects/loire_atlantique/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
db_name_dev: LOIRE_ATLANTIQUE_DBNAME_DEV
db_name_prod: LOIRE_ATLANTIQUE_DBNAME_PROD
participation_host_name: LOIRE_ATLANTIQUE_PARTICIPATION_HOST_NAME
35 changes: 35 additions & 0 deletions projects/loire_atlantique/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'loire_atlantique'
version: '1.0.0'
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: 'loire_atlantique'

# These configurations specify where dbt should look for different types of files.
# The `model-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["../demo/macros"]
snapshot-paths: ["snapshots"]

clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"


# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models

# In this example config, we tell dbt to build all models in the example/
# directory as views. These settings can be overridden in the individual model
# files using the `{{ config(...) }}` macro.
models:
loire_atlantique:
+materialized: table
Empty file.
5 changes: 5 additions & 0 deletions projects/loire_atlantique/packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packages:
- local: ../demo
- local: ../packages/initiatives
- package: dbt-labs/dbt_utils
version: 1.2.0
30 changes: 30 additions & 0 deletions projects/loire_atlantique/profiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
loire_atlantique:
target: preprod
outputs:
dev:
dbname: "{{ env_var('DBNAME') }}"
host: "{{ env_var('HOST') }}"
pass: "{{ env_var('PASSWORD') }}"
port: "{{ env_var('PORT') | as_number }}"
schema: "{{ env_var('TARGET_SCHEMA') }}"
threads: 2
type: postgres
user: "{{ env_var('USER') }}"
preprod:
dbname: "{{ env_var('DBNAME') }}"
host: "{{ env_var('HOST_PREPROD') }}"
pass: "{{ env_var('PASSWORD_PREPROD') }}"
port: "{{ env_var('PORT_PREPROD') | as_number }}"
schema: "{{ env_var('TARGET_SCHEMA') }}"
threads: 2
type: postgres
user: "{{ env_var('USER_PREPROD') }}"
prod:
dbname: "{{ env_var('DBNAME') }}"
host: "{{ env_var('HOST') }}"
pass: "{{ env_var('PASSWORD') }}"
port: "{{ env_var('PORT') | as_number }}"
schema: "{{ env_var('TARGET_SCHEMA') }}"
threads: 2
type: postgres
user: "{{ env_var('USER') }}"
2 changes: 2 additions & 0 deletions projects/loire_atlantique/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dbt-postgres==1.8.2
dbt-core==1.8.2
Empty file.
Empty file.
Empty file.
Loading