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

Error while creating tables. #44

Closed
caterpillars opened this issue Jan 30, 2015 · 10 comments
Closed

Error while creating tables. #44

caterpillars opened this issue Jan 30, 2015 · 10 comments

Comments

@caterpillars
Copy link

Hi,

I am new to big query, and i am trying to create a test table into big query using this BigQuery-Python. I was able to query an existing table, but get the following error while trying to create/delete tables.

ERROR:root:Cannot create table sample.my_table
Http Error:

Could you please advice on what might be wrong?

Thanks!

@tylertreat
Copy link
Owner

Can you post the code you're using please?

@caterpillars
Copy link
Author

Sure. I just copy your example and change the dataset name to mine. Here is the code:

Create a new table.

schema = [
{'name': 'foo', 'type': 'STRING', 'mode': 'nullable'},
{'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'}
]
created = client.create_table('sample', 'my_table', schema)

The error I got is:

ERROR:root:Cannot create table sample.my_table
Http Error:

Thanks!

@tylertreat
Copy link
Owner

@caterpillars This is sort of tangential, but it looks like there might be a bug in the error logging code. Can you try changing e.message (on this line) to e.content. Hopefully this will show what the actual error is.

@caterpillars
Copy link
Author

Thanks! I did that and found out the error is because of insufficient permission. Here is the error message:

ERROR:root:Cannot create table sample.my_table
Http Error: {
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}

I configured my project in bigquery and the python as in the example. Is there anything else I can check and change to make this work?

Thanks

@tylertreat
Copy link
Owner

Does the error only occur when creating a table in the dataset? Can you query any existing tables in the dataset? Can you create datasets?

Ensure that the project id and service account match your credentials and that those credentials have the proper permissions for the project.

@caterpillars
Copy link
Author

I can query existing tables from python just fine and I am (my email) has 'is owner' access of the project. The service account I am using has 'can edit' access of this project. Is there anything else I can check?

Thanks!

@caterpillars
Copy link
Author

Here is the screenshot of the credentials on this project. I saw two service accounts on this projects. Will this be a problem?

image

@tylertreat
Copy link
Owner

get_client defaults to a read-only client. If you want write access, make sure you're setting readonly=False.

client = get_client('my-project', service_account='my-service-account', private_key=key,
                    readonly=False)

@caterpillars
Copy link
Author

Ah.. that's why. I didn't notice that. Thanks a lot for you help! I tested create/delete datasets as well. It works. Thanks!

@tylertreat
Copy link
Owner

Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants