Auto Build TI ElasticCube datamodel via API
Project description
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: Thecreate_datamodel.pyfile requires also the four params below, which are being defined in the main workflowYAMLfile 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
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 td_ml_datamodel_create-0.1.9.tar.gz.
File metadata
- Download URL: td_ml_datamodel_create-0.1.9.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b228458d6422593b65f015797bd1ff5ad720f3597ab15beb8d213785674d8c86
|
|
| MD5 |
4c3d4e028762d06cdeec3bd39752e939
|
|
| BLAKE2b-256 |
6398498d32d5b676cb854841b31a2bd77e1175e2b5dba10d3df50b940d5ac8ec
|
File details
Details for the file td_ml_datamodel_create-0.1.9-py3-none-any.whl.
File metadata
- Download URL: td_ml_datamodel_create-0.1.9-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b480071f22922d897651a8438211e9711da2a8e33b2bfca212b3e69571e247c2
|
|
| MD5 |
60710f063997007c82b71b6f707e8cc7
|
|
| BLAKE2b-256 |
65c4771a16d8f507bec20890e1f8f74131811a53c64aaaa61bfac8b10259ef26
|