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

458 Views Asked by At

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

1

There are 1 best solutions below

0
Jose Gutierrez Paliza On

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?