parquet

Load data from files

📘

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. Aside from connecting directly to a data solution there is also a possibility to load data from parquet file. Below is an example code that should be adapted to your configuration.

data_location:
  database_type: parquet
    connection_params:
      path: PATH_TO_PARQUET
    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 to: parquet.

  • connection_params : dict, required
    Configures the connection to the database.
    For parquet, you need one required keyword argument:

    • path : str
      N o default value. The full path to the parquet file. Example: /home/data/customers.parquet.
  • 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 usage of parquet files 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: parquet
     connection_params:
       path: PATH_TO_PARQUET
     table_name: customers
   disallowed_columns: [CreatedAt]
  -type: event
   main_entity_column: UserID
   name: purchases
   date_column: Timestamp
   data_location:
     database_type: parquet
     connection_params:
       path: PATH_TO_PARQUET
     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