Skip to main content

td-ml-datamodel-create

Introduction

This Python Library allows you to define the main JSON params of a Treasure Insights Datamodel in a config.json file inside a Treasure Workflow Project and build datamodel automatically via API.

Inputs

  • config.json: the file that contains the needed params for Python code to read from and build the TI Datamodel. See below:
{
## -- (name of datamodel)
"model_name":  "datamodel_automated" 
,
## -- (list of tables to be added to datamodel)
"model_tables": [
  {"db":"sink_database","name":"table_1"},
  {"db":"sink_database","name":"table_2"}
                ] 
,
## -- (list of users to share datamodel with)
"shared_user_list": ["ENTER EMAIL HERE","ENTER EMAIL HERE"] 
,
## -- (list of columns you want to change datatype from raw table to datamodel. Ex. in "date" you provide column names that will be converted to `datetime`)
"change_schema_cols": {"date": ["ENTER_NAME"], "text": ["ENTER_NAME"], "float": ["ENTER NAME"], "bigint": ["ENTER NAME"]}
, 
## -- (if any joins were required you can add a list of table_name:join_key pairs)
"join_relations": {"pairs":
[ 
  {"db1": "sink_database", "tb1":"table_1","join_key1":"user_id","db2": "sink_database","tb2":"table_2","join_key2":"user_id"},
  {"db1": "sink_database", "tb1":"table_1","join_key1":"date","db2": "sink_database","tb2":"table_2","join_key2":"date"}
]
                  }
}
  • input_params.yml: The create_datamodel.py file requires also the four params below, which are being defined in the main workflow YAML file and imported into Custom Scripting as _env variables.
Declare ENV Variables from YML file
  • apikey = os.environ['TD_API_KEY']
  • tdserver = os.environ['TD_API_SERVER']
  • sink_database = os.environ['SINK_DB']
  • output_table = os.environ['OUTPUT_TABLE']

Copyright © 2022 Treasure Data, Inc. (or its affiliates). All rights reserved

Metadata

Release files for td-ml-datamodel-create 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for td-ml-datamodel-create 0.1.9
File Size Uploaded
td_ml_datamodel_create-0.1.9.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for td-ml-datamodel-create 0.1.9
File Interpreter ABI Platform
td_ml_datamodel_create-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / td_ml_datamodel_create-0.1.9.tar.gz

Download URL td_ml_datamodel_create-0.1.9.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b228458d6422593b65f015797bd1ff5ad720f3597ab15beb8d213785674d8c86
BLAKE2b-256 checksum
How to use checksums
6398498d32d5b676cb854841b31a2bd77e1175e2b5dba10d3df50b940d5ac8ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / td_ml_datamodel_create-0.1.9-py3-none-any.whl

Download URL td_ml_datamodel_create-0.1.9-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b480071f22922d897651a8438211e9711da2a8e33b2bfca212b3e69571e247c2
BLAKE2b-256 checksum
How to use checksums
65c4771a16d8f507bec20890e1f8f74131811a53c64aaaa61bfac8b10259ef26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page