Skip to content

Commit 3d99789

Browse files
committed
Update README.md
1 parent 674b45c commit 3d99789

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,36 @@ query = render_query(
9090

9191
job_id, _ = client.query(query, timeout=0)
9292
```
93+
94+
# Managing Tables
95+
96+
The BigQuery client provides facilities to manage dataset tables, including creating, deleting, and checking the existence of tables.
97+
98+
```python
99+
# Create a new table.
100+
schema = [
101+
{'name': 'foo', 'type': 'STRING', 'mode': 'nullable'},
102+
{'name': 'bar', 'type': 'FLOAT', 'mode': 'nullable'}
103+
]
104+
created = client.create_table('dataset', 'my_table', schema)
105+
106+
# Delete an existing table.
107+
deleted = client.delete_table('dataset', 'my_table')
108+
109+
# Check if a table exists.
110+
exists = client.check_table('dataset', 'my_table')
111+
```
112+
113+
# Inserting Data
114+
115+
The client also provides an API for inserting data into a BigQuery table.
116+
117+
```python
118+
# Insert data into table.
119+
rows = [
120+
{'lang': 'es', 'one': 'uno', 'two': 'dos'},
121+
{'lang': 'de', 'one': 'ein', 'two': 'zwei'}
122+
]
123+
inserted = client.push_rows(rows, 'lang', 'dataset', 'table')
124+
```
125+

0 commit comments

Comments
 (0)