Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigQueryCreateExternalTableOperator uses deprecated function #24160

Closed
1 task done
eladkal opened this issue Jun 3, 2022 · 5 comments · Fixed by #24363
Closed
1 task done

BigQueryCreateExternalTableOperator uses deprecated function #24160

eladkal opened this issue Jun 3, 2022 · 5 comments · Fixed by #24363
Assignees
Labels
area:providers good first issue kind:task A task that needs to be completed as part of a larger issue provider:google Google (including GCP) related issues

Comments

@eladkal
Copy link
Contributor

eladkal commented Jun 3, 2022

Body

The BigQueryCreateExternalTableOperator uses create_external_table:

table = bq_hook.create_external_table(
external_project_dataset_table=self.destination_project_dataset_table,
schema_fields=schema_fields,
source_uris=source_uris,
source_format=self.source_format,
autodetect=self.autodetect,
compression=self.compression,
skip_leading_rows=self.skip_leading_rows,
field_delimiter=self.field_delimiter,
max_bad_records=self.max_bad_records,
quote_character=self.quote_character,
allow_quoted_newlines=self.allow_quoted_newlines,
allow_jagged_rows=self.allow_jagged_rows,
src_fmt_configs=self.src_fmt_configs,
labels=self.labels,
encryption_configuration=self.encryption_configuration,
)

this function is deprecated:

warnings.warn(
"This method is deprecated. Please use `BigQueryHook.create_empty_table` method with "
"passing the `table_resource` object. This gives more flexibility than this method.",
DeprecationWarning,
)

The task:
Refactor/change the operator to replace create_external_table with create_empty_table.

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.
@eladkal eladkal added provider:google Google (including GCP) related issues area:providers good first issue kind:task A task that needs to be completed as part of a larger issue labels Jun 3, 2022
@cswpy
Copy link
Contributor

cswpy commented Jun 3, 2022

Hello @eladkal, I can take this issue.

@eladkal
Copy link
Contributor Author

eladkal commented Jun 3, 2022

@cswpy assigned

@cswpy
Copy link
Contributor

cswpy commented Jun 3, 2022

Thanks for assigning me the task.
I took a look at the code and I want to make sure that my approach is correct before proceeding. I should create a table_resouce (where I would define info relating to the external table) object to pass into the create_empty_table?

@potiuk
Copy link
Member

potiuk commented Jun 4, 2022

I think it's better to discuss with the code and in PR - make a draft PR with your proposal and it can be discussed there - it's far easier this way because the discussion can be focused around the actual code without looking it up and guessing what you really want to do @cswpy.

@cswpy
Copy link
Contributor

cswpy commented Jun 4, 2022

Thanks for the tip @potiuk. I will come up with something and submit a PR.

eladkal pushed a commit that referenced this issue Jul 12, 2022
…on (#24363)

* Fixed BigQueryCreateExternalTableOperator and its unit test (#24160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers good first issue kind:task A task that needs to be completed as part of a larger issue provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants