Teradata Package for Python Function Reference on VantageCloud Lake - from_query - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
20.00.00.11
Publication Date
August 2026
Content Type
Programming Reference
Publication ID
B700-4500-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage
teradataml.store.feature_store.models.FeatureGroup.from_query = from_query(name, entity_columns, query, timestamp_column=None) method of builtins.type instance
DESCRIPTION:
    Method to create FeatureGroup from Query.
 
PARAMETERS:
    name:
        Required Argument.
        Specifies the name of the FeatureGroup.
        Note:
            * Entitiy, DataSource also get the same name as "name".
              Users can change the name of Entity or DataSource by accessing
              object from FeatureGroup.
        Types: str.
 
    entity_columns:
        Required Argument.
        Specifies the column names for the Entity.
        Types: str or list of str.
 
    query:
        Required Argument.
        Specifies the query for DataSource.
        Types: str.
 
    timestamp_column:
        Optional Argument.
        Specifies the name of the column in the Query which
        holds the record creation time.
        Types: str OR teradataml DataFrame column
 
RETURNS:
    FeatureGroup
 
RAISES:
    None
 
EXAMPLES:
    >>> load_example_data('dataframe', ['sales'])
    >>> df = DataFrame("sales")
 
    # Example 1: Create a FeatureGroup from query 'SELECT * FROM SALES' and
    #            consider 'accounts' column as entity and 'datetime' column
    #            as timestamp_column.
    >>> from teradataml import FeatureGroup
    >>> query = 'SELECT * FROM SALES'
    >>> fg = FeatureGroup.from_query(
    ...             name='sales',
    ...             entity_columns='accounts',
    ...             query=query,
    ...             timestamp_column='datetime'
    ...         )
 
    # Example 2: Create a FeatureGroup from query 'SELECT * FROM SALES' and
    #            consider 'accounts' and 'jan' columns as entity and 'datetime' column
    #            as timestamp_column. Here, timestamp_column is specified
    #            as ColumnExpression.
    >>> from teradataml import FeatureGroup, ColumnExpression
    >>> query = 'SELECT * FROM SALES'
    >>> fg = FeatureGroup.from_query(
    ...             name='sales',
    ...             entity_columns=['accounts', 'jan'],
    ...             query=query,
    ...             timestamp_column=df.datetime)