featurebyte.TimestampSchema¶
class TimestampSchema( 
*, 
format_string: Optional[str]=None, 
is_utc_time: Optional[bool]=None, 
timezone: Union[TimeZoneName, TimeZoneColumn, NoneType]=None
)Description¶
Schema for a timestamp column. To be embedded within a ColumnSpec
Parameters¶
- format_string: Optional[str]
 Format string for the timestamp column represented as a string. This format is specific to the underlying database and is used to parse the timestamp values.
 - Databricks (Spark SQL): (example: "yyyy-MM-dd HH:mm:ss")
 Spark SQL Date and Timestamp Functions
 - Snowflake: (example: "YYYY-MM-DD HH24:MI:SS")
 Snowflake Date and Time Formats
 - BigQuery: (example: "%Y-%m-%d %H:%M:%S")
 BigQuery Date and Time Functions
- is_utc_time: Optional[bool]
 Whether the timestamp values are in UTC (True) or local time (False)
- timezone: Union[TimeZoneName, TimeZoneColumn, NoneType]
 The time zones are defined by the International Time Zone Database
 (commonly known as the IANA Time Zone Database or tz database). The default value is "Etc/UTC".
Examples¶
Example 1: Basic UTC Timestamp (BigQuery)
utc_timestamp = fb.TimestampSchema(
    is_utc_time=True, format_string="%Y-%m-%dT%H:%M:%SZ", timezone="Etc/UTC"
)
local_timestamp = fb.TimestampSchema(
    is_utc_time=False, format_string="yyyy-MM-dd HH:mm:ss", timezone="America/New_York"
)
Example 3: Local Time with Timezone Offset Column (Snowflake)
offset_timestamp = fb.TimestampSchema(
    is_utc_time=False,
    format_string="YYYY-MM-DD HH24:MI:SS",
    timezone=fb.TimeZoneColumn(column_name="timezone_offset", type="offset"),
)
Example 4: UTC Year-Month Timestamp (BigQuery)
See Also¶
- create_scd_table: Create slowly changing dimension table from source table
- create_time_series_table: Create time series table from source table