How to preform insert into BigQuery table of list of values using dbapi

0

I have a question regarding performing insert into a table in BigQuery using the DBAPI .

The simple insert of 1 value I was able to preform , my question is how to preform insert of list of values.

I couldn't find an example on how to do it, I want to preform something like :

query ="insert into test.test values (%s)"
self._cursor.execute(query,(('4'),('3')))

But I am getting an error

Thanks,

Nir

google-bigquery python python-db-api
2021-11-23 16:06:25
1

0

You can try the command executemany. This method is used to insert multiple rows in a single operation.

Your code should look something like:

query ="insert into test.test values (%s)" 
self._cursor.executemany(query,[('4'),('3')])

Also what is the error that you are getting?

2021-11-23 22:43:00

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................