shahar1 commented on code in PR #38430: URL: https://github.com/apache/airflow/pull/38430#discussion_r1554640254
########## airflow/providers/google/cloud/hooks/bigquery.py: ########## @@ -82,32 +83,61 @@ class BigQueryHook(GoogleBaseHook, DbApiHook): This hook uses the Google Cloud connection. - :param gcp_conn_id: The Airflow connection used for GCP credentials. :param use_legacy_sql: This specifies whether to use legacy SQL dialect. :param location: The location of the BigQuery resource. :param priority: Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE. :param api_resource_configs: This contains params configuration applied for Google BigQuery jobs. - :param impersonation_chain: This is the optional service account to - impersonate using short term credentials. - :param labels: The BigQuery resource label. + :param labels: The BigQuery resource labels. """ conn_name_attr = "gcp_conn_id" default_conn_name = "google_cloud_bigquery_default" conn_type = "gcpbigquery" hook_name = "Google Bigquery" + @classmethod + def get_connection_form_widgets(cls) -> dict[str, Any]: + """Return connection widgets to add to connection form.""" + from flask_appbuilder.fieldwidgets import BS3TextFieldWidget + from flask_babel import lazy_gettext + from wtforms import validators + from wtforms.fields.simple import BooleanField, StringField + + from airflow.www.validators import ValidJson + + connection_form_widgets = super().get_connection_form_widgets() + connection_form_widgets["use_legacy_sql"] = BooleanField(lazy_gettext("Use Legacy SQL"), default=True) + connection_form_widgets["location"] = StringField( + lazy_gettext("Location"), widget=BS3TextFieldWidget() + ) + connection_form_widgets["priority"] = StringField( + lazy_gettext("Priority"), + default="INTERACTIVE", + widget=BS3TextFieldWidget(), + validators=[validators.AnyOf(["INTERACTIVE", "BATCH"])], + ) + connection_form_widgets["api_resource_configs"] = StringField( + lazy_gettext("API Resource Configs"), widget=BS3TextFieldWidget(), validators=[ValidJson()] + ) + connection_form_widgets["labels"] = StringField( + lazy_gettext("Labels"), widget=BS3TextFieldWidget(), validators=[ValidJson()] + ) + return connection_form_widgets + + @classmethod + def get_ui_field_behaviour(cls) -> dict[str, Any]: + """Return custom field behaviour.""" + return super().get_ui_field_behaviour() Review Comment: Now I recall why I added it in the first place - for some reason, this method is not inherited unless explicitly stated. The parent's class utilizes this method hides some fields - and I would like to reuse this one here. I didn't manage to do it without explicitly calling it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org