<insert description here>
Project description
dagster-teradata
A dagster module that provides integration with Teradata Vantage.
Installation
The dagster_teradata module is available as a PyPI package - install with your preferred python
environment manager.
source .venv/bin/activate
pip install dagster-teradata
Example Usage
This offers seamless integration with Teradata Vantage, facilitating efficient workflows for data processing, management, and transformation. This module supports a range of scenarios, such as executing queries, managing tables, and integrating with cloud storage solutions like AWS S3 and Azure Data Lake Storage (ADLS). Additionally, it enables compute cluster management for Teradata Vantage Cloud Lake.
import os
import pytest
from dagster import job, op, EnvVar
from dagster_teradata import TeradataResource
td_resource = TeradataResource(
host=EnvVar("TERADATA_HOST"),
user=EnvVar("TERADATA_USER"),
password=EnvVar("TERADATA_PASSWORD"),
database=EnvVar("TERADATA_DATABASE"),
)
def test_execute_query(tmp_path):
@op(required_resource_keys={"teradata"})
def example_test_execute_query(context):
result = context.resources.teradata.execute_queries(
["select order_id from orders_24", "select order_id from orders_25"], True
)
context.log.info(result)
@job(resource_defs={"teradata": td_resource})
def example_job():
example_test_execute_query()
example_job.execute_in_process(resources={"teradata": td_resource})
import os
import pytest
from dagster import job, op, EnvVar
from dagster_teradata import TeradataResource
td_resource = TeradataResource(
host=EnvVar("TERADATA_HOST"),
user=EnvVar("TERADATA_USER"),
password=EnvVar("TERADATA_PASSWORD"),
database=EnvVar("TERADATA_DATABASE"),
)
def test_drop_table(tmp_path):
@op(required_resource_keys={"teradata"})
def example_test_drop_table(context):
result = context.resources.teradata.drop_table(["process_tmp1", "process_tmp2"])
context.log.info(result)
@job(resource_defs={"teradata": td_resource})
def example_job():
example_test_drop_table()
example_job.execute_in_process(resources={"teradata": td_resource})
Here is another example of compute cluster management in Teradata VantageCloud Lake:
import os
import pytest
from dagster import job, op, EnvVar
from dagster_teradata import teradata_resource
def test_create_teradata_compute_cluster(tmp_path):
@op(required_resource_keys={"teradata"})
def example_create_teradata_compute_cluster(context):
"""Args for create_teradata_compute_cluster():
compute_profile_name: Name of the Compute Profile to manage.
compute_group_name: Name of compute group to which compute profile belongs.
query_strategy: Query strategy to use. Refers to the approach or method used by the
Teradata Optimizer to execute SQL queries efficiently within a Teradata computer cluster.
Valid query_strategy value is either 'STANDARD' or 'ANALYTIC'. Default at database level is STANDARD
compute_map: ComputeMapName of the compute map. The compute_map in a compute cluster profile refers
to the mapping of compute resources to a specific node or set of nodes within the cluster.
compute_attribute: Optional attributes of compute profile. Example compute attribute
MIN_COMPUTE_COUNT(1) MAX_COMPUTE_COUNT(5) INITIALLY_SUSPENDED('FALSE')
compute_attribute (str, optional): Additional attributes for compute profile. Defaults to None.
"""
context.resources.teradata.create_teradata_compute_cluster(
"ShippingCG01",
"Shipping",
"STANDARD",
"TD_COMPUTE_MEDIUM",
"MIN_COMPUTE_COUNT(1) MAX_COMPUTE_COUNT(1) INITIALLY_SUSPENDED('FALSE')",
)
@job(resource_defs={"teradata": teradata_resource})
def example_job():
example_create_teradata_compute_cluster()
example_job.execute_in_process(
run_config={
"resources": {
"teradata": {
"config": {
"host": EnvVar("TERADATA_HOST"),
"user": EnvVar("TERADATA_USER"),
"password": EnvVar("TERADATA_PASSWORD"),
"database": EnvVar("TERADATA_DATABASE"),
}
}
}
}
)
Development
The Makefile provides the tools required to test and lint your local installation.
make test
make ruff
make check
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dagster_teradata-0.0.2.tar.gz.
File metadata
- Download URL: dagster_teradata-0.0.2.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34cfbbc6348dff83cab60cce85f0848cdcdf1399de3f9008c068e7f35a4742a6
|
|
| MD5 |
e2d0dd13fc44c5775218aa61dc415c79
|
|
| BLAKE2b-256 |
977569e2056f39f27f6754379543005f1efbaef9bec81dbb38b8e58bfa6d86a5
|
File details
Details for the file dagster_teradata-0.0.2-py3-none-any.whl.
File metadata
- Download URL: dagster_teradata-0.0.2-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10d3b44b0c17ce91d1a17f6467826f4478d167b4ac8336b8e3bb47f47a058d2f
|
|
| MD5 |
afaa6f375f54c1e7b4880789c5457951
|
|
| BLAKE2b-256 |
5c61fc5e98685f55077f4e3b6f0797d77aa3f9037c40ed6b1d7483633de97fe5
|