as_of() | Teradata Package for Python - as_of() - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Published
March 2025
ft:locale
en-US
ft:lastEdition
2025-12-05
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

Use the as_of() function to perform time-travel queries on temporal tables.

Optional Parameters

valid_time
Specifies the valid time to retrieve data from DataFrame created on either ValidTime or BiTemporal table/view.

Either "valid_time" or "transaction_time" must be provided.

Permitted values:
  • "current" - Gets the current valid time data.

    Any string other than "current" is considered as date and data will be retrieved at that of time.

  • date object - Gets the data valid on that date.
  • datetime object - Gets the data valid at that point of time.
  • tuple - Gets the data which is valid between the two valid times.

    tuple should have only two elements. First element considered as starting time and second element considered as end time for a period of time. Records will be retrieved which are valid between the two valid times.

    • Both elements can be of date or datetime or string type. If you use this string, make sure the string represents a valid date.
    • Any element can be None.
    • If first element is None and valid time dimension column is PERIOD_DATE type, then it is considered as '0001-01-01'.
    • If first element is None and valid time dimension column is PERIOD_TIMESTAMP type, then it is considered as '0001-01-01 00:00:00.000000+00:00'.
    • If second element is None and valid time dimension column is PERIOD_DATE type, then it is considered as '9999-12-31'.
    • If second element is None and valid time dimension column is PERIOD_TIMESTAMP type, then it is considered as '9999-12-31 23:59:59.999999+00:00'.
  • None - Considers the DataFrame as regular DataFrame and retrieves all the records from valid time dimension.
include_valid_time_column
Specifies whether to include the valid time dimension column in the resultant DataFrame.

When set to True, valid time dimension column is included in resultant DataFrame. Otherwise, valid time dimension column is not included in resultant DataFrame.

Ignored when "valid_time" is either tuple or None.

Default value: False

transaction_time
Specifies the transaction time to retrieve data from DataFrame created on either TransactionTime or BiTemporal table/view.

Either "valid_time" or "transaction_time" must be provided.

Permitted values:
  • "current" - Gets the records which are valid at current time.

    any string other than "current" is considered as timestamp and records which are valid at that of time.

  • datetime object - Gets the records which are valid at that point of time.
  • None - Considers the DataFrame as regular DataFrame and retrieves all the records from transaction time dimension.
include_transaction_time_column
Specifies whether to include the transaction time dimension column in the resultant DataFrame.

When set to True, transaction time dimension column is included in resultant DataFrame. Otherwise, transaction time dimension column is not included in resultant DataFrame.

Default value: False

additional_period
Specifies the additional period to be kept in resultant DataFrame.

This is applicable only when "valid_time" is None.