Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@aribray
Copy link
Contributor

@aribray aribray commented Nov 14, 2022

Adds default_value_expression to SchemaField.

        default_value_expression: str, Optional
            Used to specify the default value of a field using a SQL expression. It can only be set for
            top level fields (columns).

            You can use a struct or array expression to specify default value for the entire struct or
            array. The valid SQL expressions are:

            - Literals for all data types, including STRUCT and ARRAY.

            - The following functions:

                `CURRENT_TIMESTAMP`
                `CURRENT_TIME`
                `CURRENT_DATE`
                `CURRENT_DATETIME`
                `GENERATE_UUID`
                `RAND`
                `SESSION_USER`
                `ST_GEOPOINT`

            - Struct or array composed with the above allowed functions, for example:

                "[CURRENT_DATE(), DATE '2020-01-01'"]

Googlers see 241007941

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery API. labels Nov 14, 2022
@aribray aribray marked this pull request as ready for review November 15, 2022 01:25
@aribray aribray requested a review from a team November 15, 2022 01:25
@aribray aribray requested a review from a team as a code owner November 15, 2022 01:25
@aribray aribray requested a review from shollyman November 15, 2022 01:26
@aribray aribray requested a review from shollyman November 15, 2022 15:12
@aribray aribray merged commit 207aa50 into googleapis:main Nov 15, 2022
@aribray aribray deleted the aribray--default-value-expression branch November 15, 2022 20:57
@aribray aribray changed the title feat: add default value expression feat: add default value expression to SchemaField Nov 15, 2022
FurcyPin added a commit to FurcyPin/bigquery-frame that referenced this pull request Dec 3, 2022
Following this change:
googleapis/python-bigquery#1408
the SchemaField __init__ and __repr__ method have evolved.

This broke some tests.
FurcyPin added a commit to FurcyPin/bigquery-frame that referenced this pull request Dec 24, 2022
Following this change:
googleapis/python-bigquery#1408
the SchemaField __init__ and __repr__ method have evolved.

This broke some tests.
abdelmegahedgoogle pushed a commit to abdelmegahedgoogle/python-bigquery that referenced this pull request Apr 17, 2023
* feat: Adds default_value_expression to SchemaField
name: str,
field_type: str,
mode: str = "NULLABLE",
default_value_expression: str = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: @shollyman , this was a breaking change. Python allows for this to be both positional and keyword argument unless you use *, syntax added to Python 3.0 https://peps.python.org/pep-3102/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants