The Flink adapter plugin for dbt
Project description
DBT-Flink Adapter
This is POC for DBT-FLINK adapter
rerequisities
- Flink 1.16+
- Flink SqlGateway
Usage
Before we start to play with dbt adapter, we need to setup Flink cluster with SqlGateway configured and running. To simplify that process we prepared Docker Compose configuration.
Install dbt-flink-adapter
cd project_example
python3 -m venv venv
source venv/bin/activate
pip install dbt-flink-adapter
dbt --version
dbt-flink
should be enlisted among plugins
Configure DBT profile
Locate DBT profile on your machine.
It should be in home directory under ~/.dbt/profiles.yml
Add there below config:
flink_profile:
target: dev
outputs:
dev:
type: flink
host: localhost
port: 8083
session_name: test_session
Launch Flink cluster
cd envs/kafka
docker compose up
cd envs/flink-1.16
docker compose up
Play with sample DBT project with dbt-flink
adapter
dbt test
dbt run
FLink SQL tables should be created on Flink cluster
tear down Flink cluster
docker compose stop
Creating DBT model
TODO
Source
Type
Flink supports sources in batch and streaming mode, use type
to select what execution environment will be used during source creation.
Watermark
To provide watermark pass column
and strategy
reference under watermark
key in config.
Example:
sources:
- name: my_source
tables:
- name: clickstream
config:
type: streaming
connector_properties:
...
watermark:
column: event_timestamp
strategy: event_timestamp
columns:
- name: event_timestamp
data_type: TIMESTAMP(3)
SQL passed to Flink will look like:
CREATE TABLE IF NOT EXISTS my_source (
`<column>` TIMESTAMP(3),
WATERMARK FOR <column> AS <strategy>
) WITH (
...
)
Please refer to Flink documentation about possible strategies: flink-doc/watermark
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dbt_flink_adapter-1.3.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd0b495e5e916f280d162fdfe7745f3ba2ba41cb0b0efa9b6450ccb578a8f850 |
|
MD5 | bc1fc153c650bf0acb2daf56b6297edb |
|
BLAKE2b-256 | 0e02aa521283cdd81d9ae455a5fcab4c8ea76466fe94d1df1cb14b36cf08829e |