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

In CI jobs I would like to create tables from schemas defined in files #204

Closed
byapparov opened this issue Feb 28, 2018 · 6 comments

Comments

@byapparov
Copy link
Contributor

commented Feb 28, 2018

Currently the only way to create a table with fields seems to be uploading data, which causes problems as field types are assigned implicitly based on types in R.

There is a insert_table function which allows to create empty table without fields. Not sure what is the use case for that. It would be great if we were able to define table with fields.

@VictArt

This comment has been minimized.

Copy link

commented Mar 2, 2018

#Did you try this?
insert_upload_job(your_project, dataset_name, table_name, file, create_disposition="CREATE_IF_NEEDED", schema = read_json('given_schema.json'))

#this works great with files <= 10MB`

@byapparov

This comment has been minimized.

Copy link
Contributor Author

commented Mar 2, 2018

What if I need to create an empty time partitioned table?

@byapparov

This comment has been minimized.

Copy link
Contributor Author

commented Mar 2, 2018

Also looking at the code of insert_upload_job it is not obvious that schema passed in schema parameter will not be overridden by schema_fields(values)

@VictArt

This comment has been minimized.

Copy link

commented Mar 2, 2018

Hmm, schema = list(fields = schema_fields(values)) it just a predefined parameter in config which will be changed by explicitly specified argument in insert_upload_job(schema = read_json('given_schema.json'), ...). Looks obvious, as for me.

@VictArt

This comment has been minimized.

Copy link

commented Mar 3, 2018

Yes, you are right - schema_fields(values) will override argument schema of function insert_upload_job. I was wrong.
Looks like schema = schema in config list will be better

@byapparov

This comment has been minimized.

Copy link
Contributor Author

commented Mar 3, 2018

Have a look at PR #203, I intend to use in our workflow asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.