Skip to content

Commit

Permalink
docs(bigquery): document how to load data as JSON string (#9231)
Browse files Browse the repository at this point in the history
  • Loading branch information
plamut authored and tswast committed Sep 26, 2019
1 parent 19ff6a6 commit f6e185f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bigquery/google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,22 @@ def load_table_from_json(
json_rows (Iterable[Dict[str, Any]]):
Row data to be inserted. Keys must match the table schema fields
and values must be JSON-compatible representations.
.. note::
If your data is already a newline-delimited JSON string,
it is best to wrap it into a file-like object and pass it
to :meth:`~google.cloud.bigquery.client.Client.load_table_from_file`::
import io
from google.cloud import bigquery
data = u'{"foo": "bar"}'
data_as_file = io.StringIO(data)
client = bigquery.Client()
client.load_table_from_file(data_as_file, ...)
destination (Union[ \
:class:`~google.cloud.bigquery.table.Table`, \
:class:`~google.cloud.bigquery.table.TableReference`, \
Expand Down

0 comments on commit f6e185f

Please sign in to comment.