Thread
#prefect-community
    b

    Bob Colner

    4 months ago
    follow up
    prefect-gcp
    issue using the
    bigquery_insert_stream
    task. I’m not able to pass
    Timestamp
    data-types -getting:
    TypeError: Object of type Timestamp is not JSON serializable
    not a prefect issue -but wondering if there is a good work-around
    I guess I just need to pass the
    Timestamp
    as an iso formatted string -hope this ends up in bigquery as a Timestamp
    that worked 😉
    Andrew Huang

    Andrew Huang

    4 months ago
    is it similar to the one below with the dataset column as Timestamp type?
    ```python
            from prefect import flow
            from prefect_gcp import GcpCredentials
            from prefect_gcp.bigquery import bigquery_insert_stream
            from google.cloud.bigquery import SchemaField
            @flow
            def example_bigquery_insert_stream_flow():
                gcp_credentials = GcpCredentials(project="project")
                records = [
                    {"timestamp": "2022-02-03 10:00", "text": "abc", "bool": True},
                ]
                result = bigquery_insert_stream(
                    dataset="integrations",
                    table="test_table",
                    records=records,
                    gcp_credentials=gcp_credentials
                )
                return result
    b

    Bob Colner

    4 months ago
    yes, my BQ schema had a Timestamp col, and I passed a isoformated timestamp string to
    biquery_insert_stream