RedshiftConfig
Summary​
Configuration used to reference a Redshift table or query.Â
The RedshiftConfig class is used to create a reference to a Redshift table. You can also create a reference to a query on one or more tables, which will be registered in Tecton in a similar way as a view is registered in other data systems.
Â
This class used as an input to a
BatchSource
's parameter batch_config
. This class is not
a Tecton Object: it is a grouping of parameters. Declaring this class alone will not register a data source.
Instead, declare as part of BatchSource
that takes this configuration class instance as a parameter.
Attributes​
The attributes are the same as the __init__
method parameters. See below.
Methods​
Name | Description |
---|---|
__init__(...) | Instantiates a new RedshiftConfig. One of table and query should be specified when creating this file. |
__init__(...)​
Instantiates a new RedshiftConfig. One of table and query should be specified when creating this file.Â
Example of a RedshiftConfig declaration:
Parameters
endpoint
(str
) - The connection endpoint to Redshift (e.g. redshift-cluster-1.cigcwzsdltjs.us-west-2.redshift.amazonaws.com:5439/dev).table
(Optional
[str
]) - The Redshift table for this Data source. Only one of table and query should be specified. Default:None
post_processor
(Optional
[Callable
]) - Python user defined functionf(DataFrame) -> DataFrame
that takes in raw PySpark data source DataFrame and translates it to the DataFrame to be consumed by the Feature View. Default:None
query
(Optional
[str
]) - A Redshift query for this Data source. Only one of table and query should be specified. Default:None
timestamp_field
(Optional
[str
]) - The timestamp column in this data source that should be used byFilteredSource
to filter data from this source, before any feature view transformations are applied. Only required if this source is used withFilteredSource
. Default:None
data_delay
(timedelta
) - By default, incremental materialization jobs run immediately at the end of the batch schedule period. This parameter configures how long they wait after the end of the period before starting, typically to ensure that all data has landed. For example, if a feature view has abatch_schedule
of 1 day and one of the data source inputs hasdata_delay=timedelta(hours=1)
set, then incremental materialization jobs will run at01:00
UTC. Default:0:00:00
Returns
A RedshiftConfig class instance.Example
from tecton import RedshiftConfig
# Declare RedshiftConfig instance object that can be used as an argument in BatchSource
redshift_ds_config = RedshiftConfig(endpoint="cluster-1.us-west-2.redshift.amazonaws.com:5439/dev",
query="SELECT timestamp as ts, created, user_id, ad_id, duration"
"FROM ad_serving_features")