Skip to content

Conversation

@noah-goodrich
Copy link

When trying to run a BigQueryFileLoads job, I receive the following error:

ValidationError: Expected type <class 'apache_beam.io.gcp.internal.clients.bigquery.bigquery_v2_messages.TableSchema'> for field schema, found {"fields": [{"name": "id", "type": "INTEGER", "mode": "required"}, {"name": "description", "type"
: "STRING", "mode": "nullable"}]} (type <class 'str'>)

R: @chamikaramj

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • [ X] Choose reviewer(s) and mention them in a comment (R: @username).
  • [X ] Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • [ X] If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

Copy link
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks.

toxworkdir = {toxinidir}/target/{env:ENV_NAME:.tox}

[flake8]
ignore = E111,E114,E121,E125,E127,E129,E226,E302,E41,E502,W503,W504
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these being ignored ? Please start a separate PR if you think we need this.

Copy link
Author

Choose a reason for hiding this comment

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

Locally flake8 identified all of these as errors in the file I am trying to edit. Rather than refactor the file to match all of these rules, I thought it was simpler for myself and anyone else coming behind if flake8 knows that those rules aren't enforced. For example, a lot of the code was indented by multiples of 2 instead of 4, etc.


if isinstance(schema, (str, unicode)):
schema = bigquery_tools.parse_table_schema_from_json(schema)
elif isinstance(schema, dict):
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain the underlying issue here ? (couldn't find details in the JIRA).

Could the issue be that you are specifying an incompatible/incorrect schema object ? Can you try specifying schema as a TableSchema object ? For example, see here: https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/gcp/bigquery_write_it_test.py#L80

If you are fixing an actual underlying issue here, please add a unit test.

Copy link
Author

Choose a reason for hiding this comment

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

Apologies if the issue as described was not clear.

Basically - I was trying to creating a dataflow template, which requires using ValueProvider argument. I do not believe it is possible to pass a serialized object as the argument in this case.

I'm actually borrowing the logic from here: https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/gcp/bigquery.py#L757

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks. Can you please add a unit test.

Copy link
Author

Choose a reason for hiding this comment

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

@chamikaramj I am working on it. Having a very difficult time trying to get the tests running locally.

Copy link
Contributor

Choose a reason for hiding this comment

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

@chamikaramj
Copy link
Contributor

cc: @pabloem

@kennknowles
Copy link
Member

🎆 🍾 🎉 🎈

Pull request #10000!

@stale
Copy link

stale bot commented Jan 7, 2020

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label Jan 7, 2020
@stale
Copy link

stale bot commented Jan 14, 2020

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@stale stale bot closed this Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants