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

GoogleCloudStorageToBigQueryOperator reads string as a list in parameter source_objects #16008

Closed
stavhaco opened this issue May 23, 2021 · 6 comments · Fixed by #16160
Closed
Assignees
Labels
good first issue kind:feature Feature Requests provider:google Google (including GCP) related issues

Comments

@stavhaco
Copy link

Apache Airflow version:1.10.12
Environment: google cloud composer

What happened:
When using GoogleCloudStorageToBigQueryOperator and providing string as parameter source_objects, the process is iterating on a the string as a valid list.
For example -
cloud_storage_to_bigquery = GoogleCloudStorageToBigQueryOperator( bucket = 'bucket', source_objects = 'abc', )
Will result in looking into the sources: bucket/a, bucket/b, bucket/c.

What you expected to happen:
Throw an error on type (string instead of list).

@stavhaco stavhaco added the kind:bug This is a clearly a bug label May 23, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented May 23, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@eladkal
Copy link
Contributor

eladkal commented May 23, 2021

GoogleCloudStorageToBigQueryOperator is deprecated. Please use GCSToBigQueryOperator from providers.
Note that source_objects expect list not str. You should set source_objects = ['abc']

@eladkal eladkal closed this as completed May 23, 2021
@eladkal eladkal added invalid and removed kind:bug This is a clearly a bug labels May 23, 2021
@stavhaco
Copy link
Author

@eladkal seems like the behaviour is the same in GCSToBigQueryOperator.
I get that the parameter should be set as source_objects = ['abc'] but shouldn't I expect type error when setting it to source_objects = 'abc'? instead of iterating on the chars of the string and looking for different paths based on it?

@eladkal
Copy link
Contributor

eladkal commented May 23, 2021

PRs are welcome :)

@stavhaco
Copy link
Author

@eladkal Alright. Can this be assigned to me?

@eladkal
Copy link
Contributor

eladkal commented May 23, 2021

You can just open a PR
BTW probably a better solution would be to allow str or List[str] rather than raise error.

@eladkal eladkal added good first issue kind:feature Feature Requests and removed invalid labels May 23, 2021
@eladkal eladkal reopened this May 23, 2021
@eladkal eladkal added the provider:google Google (including GCP) related issues label May 23, 2021
tegardp added a commit to tegardp/airflow that referenced this issue May 29, 2021
Fix GCS To BigQuery source_object to accept both str and list
eladkal pushed a commit that referenced this issue May 31, 2021
* Fix: GCS To BigQuery source_object #16008

Fix GCS To BigQuery source_object to accept both str and list

* convert source_objects to list if not list

converting source_objects to list instead of modifying the logic part

* add tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue kind:feature Feature Requests provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants