ClickHouse
Connection parameters in YAML configuration file
Note
This article refers to BaseModel accessed via Docker container. Please refer to Snowflake Native App section if you are using BaseModel as SF GUI application.
Various data sources are specified in the YAML
file used by the pretrain
function and configured by the entries in data_location
section. Below is an example code that should be adapted to your configuration.
data_location:
database_type: clickhouse
connection_params:
host: 'HOST_IP'
schema_name: SCHEMA
table_name: TABLE_NAME
Parameters |
---|
- database_type : str, required
No default value.
Information about the database type or source file. All data tables should be stored in the same type.
Set toclickhouse
.
- connection_params : dict, required
Configures the connection to the database.
For ClickHouse its keyword arguments are:
- host : str, required
No default value.
The hostname or IP address of the ClickHouse server. If not set, localhost will be used.
- host : str, required
- schema_name : str, required
No default value.
Specifies the name of the database to use to create features.
- table_name : str, required
No default value.
Specifies the table to use to create features.
Example:customers
.
The connection_params
should be set separately in each data_location
block, for each data source.
Example |
---|
The following example demonstrates the connection to ClickHouse in the context of a simple configuration with two data sources.
data_sources:
-type: main_entity_attribute
main_entity_column: UserID
name: customers
data_location:
database_type: clickhouse
connection_params:
host: '123.45.67.890'
schema_name: some_schema
table_name: customers
disallowed_columns: [CreatedAt]
-type: event
main_entity_column: UserID
name: purchases
date_column: Timestamp
data_location:
database_type: clickhouse
connection_params:
host: '123.45.67.890'
schema_name: some_schema
table_name: purchases
where_condition: "Timestamp >= today() - 365"
sql_lambdas:
- alias: price_float
expression: "TO_DOUBLE(price)"
Note
The detailed description of optional fields such as
disallowed_columns
,where_condition
,sql_lambda
, and many others is provided here
Updated 2 months ago