-
Notifications
You must be signed in to change notification settings - Fork 0
feature/add dlthub sample #32
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
Open
oliverw1
wants to merge
57
commits into
main
Choose a base branch
from
feature/add-dlthub-sample
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
e74ec24
skeleton project
oliverw1 b34ed0c
add getting started for uv
oliverw1 0572efb
add data loading files
Siyan-Luo cb263df
migrate data from oracle to local filesystem
Siyan-Luo cbdd992
add infra for Oracle on RDS
oliverw1 326e2d9
Merge branch 'feature/add-full-incremental-load' into feature/add-dlt…
oliverw1 3a04736
add incrementallly load the entire database
Siyan-Luo 3100fd2
Merge branch 'feature/add-full-incremental-load' into feature/add-dlt…
oliverw1 3b2bbd0
add secrets template file
Siyan-Luo 2bf6a7c
remove files whose functionality is already in main.py
oliverw1 53ddf3d
remove superfluous lines related to uv
oliverw1 f227a86
sort attributes to indicate which ones matter to the source
oliverw1 dc283db
add info on how to get missing dependencies
oliverw1 4bfae40
add notes on loading data into Oracle on RDS
oliverw1 da0ff87
add and apply pre-commit hooks
oliverw1 4f90916
fix type hints
oliverw1 034e71b
allowing the dm office access to the Oracle db
oliverw1 0421a68
style: extract common parts from config
oliverw1 d93648b
delete duplicated hooks
Siyan-Luo 1a374c2
adjust to src layout and conveyor project structure
oliverw1 6e7a5cd
style: drop useless comments
oliverw1 4a4b1e1
full load working - next is incremental
oliverw1 e60efc4
add pyarrow
oliverw1 bda6200
add remote state backend
oliverw1 3202159
add query for creating warehouse COMPUTE_WH
Siyan-Luo d31a185
grant multiple people access to reader_role
oliverw1 bcdd237
downgrade python version because of snowflake connector
oliverw1 da40a16
first docker draft
oliverw1 fc50470
extend range from German ISP O2
oliverw1 482546c
remove snowflake username as it's not needed
Siyan-Luo 7b30027
revert commit fc50470
Siyan-Luo 8629c37
name the database in caps and add variable snowflake_username ad it's…
Siyan-Luo 875a64d
snowflake provider needs user credential
Siyan-Luo 89edbd4
update renamed host name for sql database
Siyan-Luo 6a2030b
full load a small table for test in dockerfile
Siyan-Luo 8dc4c34
do not ignore .conveyor folder for now
Siyan-Luo 37a033f
add conveyor config file
Siyan-Luo 8a3de9f
add comments to explain the project.yaml
Siyan-Luo 50d1707
use correct extension, update project id
oliverw1 96f817b
update local ip
oliverw1 08e390c
allow all ips to oracle
oliverw1 ba54731
attempt big incremental load
oliverw1 655ac03
full load config to all types table
Siyan-Luo 373aeea
grant jonny dlt_reader_role
Siyan-Luo 8a27c21
add type adapter
Siyan-Luo 820de77
sql for creating oracle table of all data types
Siyan-Luo 0d060f9
add connectorx example
oliverw1 5f70d42
delete showcase pipeline file
Siyan-Luo f89dcb3
renamed dir to reflect the target of the Extract-Load process
oliverw1 572272c
update docs with findings
oliverw1 76f35e5
../../README.md
oliverw1 c375e05
wip: refactor to prep as conveyor-sample
oliverw1 bae31cb
aptly name DAG, remove unused reference
oliverw1 d5debcc
add notes where the config may be found
oliverw1 f2ed51c
Update docs, restructure Terraform code into modules
oliverw1 9a08520
Simplify getting-started using Docker
oliverw1 dfbf383
style: format with markdownlint
oliverw1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| .idea/ | ||
| .conveyor | ||
| .idea/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # put your configuration values here | ||
|
|
||
| [runtime] | ||
| log_level="WARNING" # the system log level of dlt | ||
| # use the dlthub_telemetry setting to enable/disable anonymous usage data reporting, see https://dlthub.com/docs/reference/telemetry | ||
| dlthub_telemetry = true | ||
|
|
||
| [sources.sql_database] | ||
| table = "table" # please set me up! | ||
|
|
||
| [full_load] | ||
| pipeline_name = "all_datatypes" | ||
| destination = "snowflake" | ||
| schema = "TPCH" | ||
| dataset_name = "datatypes" | ||
| table_name = ["all_data_types_demo"] | ||
|
|
||
| #[full_load] | ||
| #pipeline_name = "full_load_pipeline" | ||
| #destination = "snowflake" | ||
| #schema = "SH" | ||
| #dataset_name = "sh_full" | ||
| #table_name = ["promotions", "products", "customers"] | ||
|
|
||
| # [incremental_load] | ||
| # schema = "AUDSYS" | ||
| # table_name = ["aud$unified"] | ||
| # incremental_column = "event_timestamp" | ||
| # pipeline_name = "incremental_load_pipeline" | ||
| # destination = "snowflake" | ||
| # dataset_name = "audsys_incremental" | ||
|
|
||
| [incremental_load] | ||
| schema = "TPCH" | ||
| table_name = ["orders"] # case sensitive! | ||
| incremental_column = "o_orderdate" | ||
| pipeline_name = "incremental_load_pipeline" | ||
| destination = "snowflake" | ||
| dataset_name = "tpch_orders_incremental" | ||
|
|
||
| [incremental_with_connectorx] | ||
| schema = "TPCH" | ||
| table_name = "LINEITEM" # case sensitive! | ||
| incremental_column = "l_orderkey" | ||
| partition_column = "l_orderkey" # not the primary key of lineitem (which is linenumber + orderkey), but good for a test | ||
| pipeline_name = "incremental_load_pipeline_connectorx" | ||
| destination = "snowflake" | ||
| dataset_name = "tpch_orders_incremental_connectorx" |
23 changes: 23 additions & 0 deletions
23
basic/dlthub_oracle_to_snowflake/.dlt/secrets.toml.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| [sources.sql_database.credentials] | ||
| drivername = "oracle+oracledb" | ||
| database = "ORCL" | ||
| password = "dltpass" # Supplied in scripts/dlt-user.sql | ||
| username = "dlthub" # Supplied in scripts/dlt-user.sql | ||
| host = "take it from `terraform output rds_endpoint`, remove the port suffix" | ||
| port = same as the host, just use port suffix | ||
|
|
||
| [destination.filesystem] | ||
| dataset_name = "mydataset" | ||
| bucket_url = "database" | ||
|
|
||
| [destination.snowflake.credentials] | ||
| # All of these can be obtained from running `terraform output snowflake_credentials` in the _infra_ folder. | ||
| database = "database" # please set me up! | ||
| password = "password" # please set me up! | ||
| username = "username" # please set me up! | ||
| host = "host" # please set me up! | ||
| warehouse = "warehouse" # please set me up! | ||
| role = "role" # please set me up! | ||
|
|
||
| [pipeline] | ||
| loader_file_format="parquet" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| .env | ||
| .venv | ||
| secrets.toml | ||
| **/__pycache__/ | ||
| **/*.py[cod] | ||
| **/*$py.class | ||
| .dockerignore | ||
| Dockerfile | ||
| infra | ||
| docs | ||
| data | ||
| database | ||
| dags | ||
| tests | ||
| .pre-commit-config.yaml | ||
| README.md | ||
|
|
||
| .idea | ||
| .gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # ignore secrets, virtual environments and typical python compilation artifacts | ||
| secrets.toml | ||
| # ignore basic python artifacts | ||
| .env | ||
| .venv | ||
| **/__pycache__/ | ||
| **/*.py[cod] | ||
| **/*$py.class | ||
| # ignore databases | ||
| database/ | ||
| *.duckdb | ||
| *.wal | ||
| infra/.terraform | ||
|
|
||
| .conveyor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| repos: | ||
| # Code formatting | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.11.5 | ||
| hooks: | ||
| # Run the linter. | ||
| - id: ruff | ||
| args: [ --fix ] | ||
| # Run the formatter. | ||
| - id: ruff-format | ||
| - repo: https://github.com/antonbabenko/pre-commit-terraform | ||
| rev: v1.98.1 | ||
| hooks: | ||
| - id: terraform_fmt | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: debug-statements | ||
| - id: check-merge-conflict | ||
| - id: trailing-whitespace | ||
| - id: check-added-large-files | ||
| - id: check-ast | ||
| - id: check-json | ||
| - id: check-toml | ||
| - id: check-yaml | ||
| args: [--allow-multiple-documents] | ||
| - id: check-vcs-permalinks | ||
| - id: end-of-file-fixer | ||
| - id: fix-byte-order-marker | ||
| - id: mixed-line-ending | ||
| args: [--fix=lf] | ||
| - id: pretty-format-json | ||
|
|
||
| # checks github actions files for errors | ||
| - repo: https://github.com/rhysd/actionlint | ||
| rev: v1.7.7 | ||
| hooks: | ||
| - id: actionlint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| FROM alpine:latest as oracle | ||
|
|
||
| WORKDIR /opt/oracle | ||
| # ConnectorX activates the "thick mode" of the oracle client, so one needs some extra libs. | ||
| ADD https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip ./ | ||
| RUN unzip instantclient-basiclite-linuxx64.zip && \ | ||
| rm -f instantclient-basiclite-linuxx64.zip && \ | ||
| cd instantclient* && \ | ||
| rm -f *jdbc* *occi* *mysql* *jar uidrvci genezi adrci | ||
|
|
||
| FROM docker.io/python:3.12.9-slim-bullseye | ||
|
|
||
| COPY --from=ghcr.io/astral-sh/uv:0.6.14 /uv /bin/uv | ||
|
|
||
| RUN set -eux; \ | ||
| apt-get update; \ | ||
| apt-get install -y --no-install-recommends \ | ||
| gcc \ | ||
| libaio1 \ | ||
| unzip \ | ||
| ; \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY --from=oracle /opt/oracle /opt/oracle | ||
| RUN echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf && \ | ||
| ldconfig | ||
|
|
||
| WORKDIR /usr/src/app | ||
| # silence warnings about not being able to use hard-links for the cache-mount | ||
| RUN --mount=type=cache,target=/root/.cache/uv \ | ||
|
oliverw1 marked this conversation as resolved.
|
||
| --mount=type=bind,source=uv.lock,target=uv.lock \ | ||
| --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
| uv sync \ | ||
| --frozen \ | ||
| --compile-bytecode \ | ||
| --link-mode=copy \ | ||
| --no-install-project | ||
| ADD . . | ||
|
|
||
| RUN --mount=type=cache,target=/root/.cache/uv \ | ||
| uv sync \ | ||
| --frozen \ | ||
| --compile-bytecode \ | ||
| --link-mode=copy | ||
|
|
||
| CMD ["uv", "run", "./src/dlt_example/app.py", "full"] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed. I've added them out of habit, to ensure bash behaves more like the languages we're used to and to error out on the first failed command (e-flag). Since none of the 3 commands here is likely to give an error, it can (and will) be removed.