how to create a table using the following python bigquery api?Setting clustering column in BigQuery python apiwhy the following Bigquery insertion is failing?How do I copy a file in Python?How can I safely create a nested directory in Python?How can I remove a trailing newline in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?How do I get the number of elements in a list in Python?How do I concatenate two lists in Python?Create a dictionary with list comprehension in PythonHow do I lowercase a string in Python?

Can I sign legal documents with a smiley face?

What major Native American tribes were around Santa Fe during the late 1850s?

Should I stop contributing to retirement accounts?

Longest common substring in linear time

Visiting the UK as unmarried couple

How do ground effect vehicles perform turns?

What does this horizontal bar at the first measure mean?

Did arcade monitors have same pixel aspect ratio as TV sets?

Can the Supreme Court overturn an impeachment?

Varistor? Purpose and principle

THT: What is a squared annular “ring”?

Flux received by a negative charge

Global amount of publications over time

Some numbers are more equivalent than others

How much character growth crosses the line into breaking the character

Is a model fitted to data or is data fitted to a model?

Why do IPv6 unique local addresses have to have a /48 prefix?

How do I implement a file system driver driver in Linux?

MAXDOP Settings for SQL Server 2014

What is this type of notehead called?

Customize circled numbers

Do the concepts of IP address and network interface not belong to the same layer?

What (else) happened July 1st 1858 in London?

About a little hole in Z'ha'dum



how to create a table using the following python bigquery api?


Setting clustering column in BigQuery python apiwhy the following Bigquery insertion is failing?How do I copy a file in Python?How can I safely create a nested directory in Python?How can I remove a trailing newline in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?How do I get the number of elements in a list in Python?How do I concatenate two lists in Python?Create a dictionary with list comprehension in PythonHow do I lowercase a string in Python?













0















Hello I cloned the following repository:



https://github.com/tylertreat/BigQuery-Python



I was reading the documentation about creating a table as follows:



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


I tried to execute the same in my console as follows:



>>> schema = [
... 'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
... 'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
... ]
>>> created = client.create_table('data_set_course', 'my_table_testing', schema)


I only got 'False' and when I check the visual interface there is no table.



>>> print(created)
False
>>>


I dont have any idea about the issue, I really frustrated since I just what to create one table, so I really would like to appreciate the support to overcome this task.










share|improve this question






















  • See this question stackoverflow.com/questions/55031720/… it has good python script to reuse

    – Tamir Klein
    Mar 8 at 7:47
















0















Hello I cloned the following repository:



https://github.com/tylertreat/BigQuery-Python



I was reading the documentation about creating a table as follows:



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


I tried to execute the same in my console as follows:



>>> schema = [
... 'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
... 'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
... ]
>>> created = client.create_table('data_set_course', 'my_table_testing', schema)


I only got 'False' and when I check the visual interface there is no table.



>>> print(created)
False
>>>


I dont have any idea about the issue, I really frustrated since I just what to create one table, so I really would like to appreciate the support to overcome this task.










share|improve this question






















  • See this question stackoverflow.com/questions/55031720/… it has good python script to reuse

    – Tamir Klein
    Mar 8 at 7:47














0












0








0








Hello I cloned the following repository:



https://github.com/tylertreat/BigQuery-Python



I was reading the documentation about creating a table as follows:



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


I tried to execute the same in my console as follows:



>>> schema = [
... 'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
... 'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
... ]
>>> created = client.create_table('data_set_course', 'my_table_testing', schema)


I only got 'False' and when I check the visual interface there is no table.



>>> print(created)
False
>>>


I dont have any idea about the issue, I really frustrated since I just what to create one table, so I really would like to appreciate the support to overcome this task.










share|improve this question














Hello I cloned the following repository:



https://github.com/tylertreat/BigQuery-Python



I was reading the documentation about creating a table as follows:



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


I tried to execute the same in my console as follows:



>>> schema = [
... 'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
... 'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
... ]
>>> created = client.create_table('data_set_course', 'my_table_testing', schema)


I only got 'False' and when I check the visual interface there is no table.



>>> print(created)
False
>>>


I dont have any idea about the issue, I really frustrated since I just what to create one table, so I really would like to appreciate the support to overcome this task.







python google-bigquery python-3.6






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 6:29









neo33neo33

74711021




74711021












  • See this question stackoverflow.com/questions/55031720/… it has good python script to reuse

    – Tamir Klein
    Mar 8 at 7:47


















  • See this question stackoverflow.com/questions/55031720/… it has good python script to reuse

    – Tamir Klein
    Mar 8 at 7:47

















See this question stackoverflow.com/questions/55031720/… it has good python script to reuse

– Tamir Klein
Mar 8 at 7:47






See this question stackoverflow.com/questions/55031720/… it has good python script to reuse

– Tamir Klein
Mar 8 at 7:47













1 Answer
1






active

oldest

votes


















1














I have tested this code and it works for me:



from bigquery import get_client

# JSON key provided by Google
json_key = 'key.json'

client = get_client(json_key_file=json_key, readonly=False)

schema = [
'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
]
created = client.create_table(dataset='yourDataset', table='tableToCreate', schema=schema)



You need to check 2 things:



  1. readonly parameter in the get_client method is set to False. Otherwise BigQuery access is read-only.


  2. The service account or user provided in the key.json file has been granted with the permissions to create a BigQuery table. At least it must have the roles/bigquery.dataEditor role granted. To do it run the following command:


gcloud projects add-iam-policy-binding [PROJECT_ID] --member "serviceAccount:[NAME]@[PROJECT_ID].iam.gserviceaccount.com" --role "roles/bigquery.dataEditor"




Anyway I recommend you to use the official Python Client for Google BigQuery, you will have better documentation and functionality. As well as a huge amount of code examples in the BigQuery official documentation.






share|improve this answer























  • Thanks I am testing this api, it seems to work, thanks a lot for the support

    – neo33
    Mar 8 at 16:08











  • after the past issue now I cant execute an insert I hope you could please soporte me: stackoverflow.com/questions/55067816/… I really appreciate the support

    – neo33
    Mar 8 at 17:11











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057855%2fhow-to-create-a-table-using-the-following-python-bigquery-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














I have tested this code and it works for me:



from bigquery import get_client

# JSON key provided by Google
json_key = 'key.json'

client = get_client(json_key_file=json_key, readonly=False)

schema = [
'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
]
created = client.create_table(dataset='yourDataset', table='tableToCreate', schema=schema)



You need to check 2 things:



  1. readonly parameter in the get_client method is set to False. Otherwise BigQuery access is read-only.


  2. The service account or user provided in the key.json file has been granted with the permissions to create a BigQuery table. At least it must have the roles/bigquery.dataEditor role granted. To do it run the following command:


gcloud projects add-iam-policy-binding [PROJECT_ID] --member "serviceAccount:[NAME]@[PROJECT_ID].iam.gserviceaccount.com" --role "roles/bigquery.dataEditor"




Anyway I recommend you to use the official Python Client for Google BigQuery, you will have better documentation and functionality. As well as a huge amount of code examples in the BigQuery official documentation.






share|improve this answer























  • Thanks I am testing this api, it seems to work, thanks a lot for the support

    – neo33
    Mar 8 at 16:08











  • after the past issue now I cant execute an insert I hope you could please soporte me: stackoverflow.com/questions/55067816/… I really appreciate the support

    – neo33
    Mar 8 at 17:11
















1














I have tested this code and it works for me:



from bigquery import get_client

# JSON key provided by Google
json_key = 'key.json'

client = get_client(json_key_file=json_key, readonly=False)

schema = [
'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
]
created = client.create_table(dataset='yourDataset', table='tableToCreate', schema=schema)



You need to check 2 things:



  1. readonly parameter in the get_client method is set to False. Otherwise BigQuery access is read-only.


  2. The service account or user provided in the key.json file has been granted with the permissions to create a BigQuery table. At least it must have the roles/bigquery.dataEditor role granted. To do it run the following command:


gcloud projects add-iam-policy-binding [PROJECT_ID] --member "serviceAccount:[NAME]@[PROJECT_ID].iam.gserviceaccount.com" --role "roles/bigquery.dataEditor"




Anyway I recommend you to use the official Python Client for Google BigQuery, you will have better documentation and functionality. As well as a huge amount of code examples in the BigQuery official documentation.






share|improve this answer























  • Thanks I am testing this api, it seems to work, thanks a lot for the support

    – neo33
    Mar 8 at 16:08











  • after the past issue now I cant execute an insert I hope you could please soporte me: stackoverflow.com/questions/55067816/… I really appreciate the support

    – neo33
    Mar 8 at 17:11














1












1








1







I have tested this code and it works for me:



from bigquery import get_client

# JSON key provided by Google
json_key = 'key.json'

client = get_client(json_key_file=json_key, readonly=False)

schema = [
'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
]
created = client.create_table(dataset='yourDataset', table='tableToCreate', schema=schema)



You need to check 2 things:



  1. readonly parameter in the get_client method is set to False. Otherwise BigQuery access is read-only.


  2. The service account or user provided in the key.json file has been granted with the permissions to create a BigQuery table. At least it must have the roles/bigquery.dataEditor role granted. To do it run the following command:


gcloud projects add-iam-policy-binding [PROJECT_ID] --member "serviceAccount:[NAME]@[PROJECT_ID].iam.gserviceaccount.com" --role "roles/bigquery.dataEditor"




Anyway I recommend you to use the official Python Client for Google BigQuery, you will have better documentation and functionality. As well as a huge amount of code examples in the BigQuery official documentation.






share|improve this answer













I have tested this code and it works for me:



from bigquery import get_client

# JSON key provided by Google
json_key = 'key.json'

client = get_client(json_key_file=json_key, readonly=False)

schema = [
'name': 'foo', 'type': 'STRING', 'mode': 'nullable',
'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'
]
created = client.create_table(dataset='yourDataset', table='tableToCreate', schema=schema)



You need to check 2 things:



  1. readonly parameter in the get_client method is set to False. Otherwise BigQuery access is read-only.


  2. The service account or user provided in the key.json file has been granted with the permissions to create a BigQuery table. At least it must have the roles/bigquery.dataEditor role granted. To do it run the following command:


gcloud projects add-iam-policy-binding [PROJECT_ID] --member "serviceAccount:[NAME]@[PROJECT_ID].iam.gserviceaccount.com" --role "roles/bigquery.dataEditor"




Anyway I recommend you to use the official Python Client for Google BigQuery, you will have better documentation and functionality. As well as a huge amount of code examples in the BigQuery official documentation.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 8 at 11:25









llompallesllompalles

980414




980414












  • Thanks I am testing this api, it seems to work, thanks a lot for the support

    – neo33
    Mar 8 at 16:08











  • after the past issue now I cant execute an insert I hope you could please soporte me: stackoverflow.com/questions/55067816/… I really appreciate the support

    – neo33
    Mar 8 at 17:11


















  • Thanks I am testing this api, it seems to work, thanks a lot for the support

    – neo33
    Mar 8 at 16:08











  • after the past issue now I cant execute an insert I hope you could please soporte me: stackoverflow.com/questions/55067816/… I really appreciate the support

    – neo33
    Mar 8 at 17:11

















Thanks I am testing this api, it seems to work, thanks a lot for the support

– neo33
Mar 8 at 16:08





Thanks I am testing this api, it seems to work, thanks a lot for the support

– neo33
Mar 8 at 16:08













after the past issue now I cant execute an insert I hope you could please soporte me: stackoverflow.com/questions/55067816/… I really appreciate the support

– neo33
Mar 8 at 17:11






after the past issue now I cant execute an insert I hope you could please soporte me: stackoverflow.com/questions/55067816/… I really appreciate the support

– neo33
Mar 8 at 17:11




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057855%2fhow-to-create-a-table-using-the-following-python-bigquery-api%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229