Skip to content

Commit

Permalink
Fix code higlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelbrand-limehome committed Dec 4, 2020
1 parent 6d96465 commit aeb9f9f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pip install bq_schema
```

2. Create a schema and a table definition in my_table.py
```
```python
@dataclass
class Schema:
string_field: str = field(metadata={"description": "This is a STRING field."})
Expand Down Expand Up @@ -57,7 +57,7 @@ migrate-tables --project my_project --dataset my_dataset --module-path my_table
```

4. Write a row
```
```python
from google.cloud import bigquery
row = Schema(string_field="foo", int_field=1, some_floats=[1.0, 2.0], bool_field=True)
row_transformer = RowTransformer[Schema](Schema)
Expand All @@ -74,7 +74,7 @@ mypy my_table.py
```

6. Read a row
```
```python
query = "SELECT * FROM project.dataset.my_table_name"
for row in bigquery_client.query(query=query):
deserialized_row = row_transformer.bq_row_to_dataclass_instance(row)
Expand All @@ -86,7 +86,7 @@ for row in bigquery_client.query(query=query):

### Schema definitions
For a full list of supported types check the following schema:
```
```python
from typing import Optional

class RequiredNestedField:
Expand Down Expand Up @@ -126,7 +126,7 @@ The bigquery class is used for:

#### Versioning tables
Since bigquery does not allow backwards incompatible schema changes, you might want to version your schemas.project
```
```python
class MyTable(BigqueryTable):
name = "my_table_name"
schema = Schema
Expand All @@ -137,7 +137,7 @@ you can implement the full_table_name method.

#### Time partitioning
Define time partitioning for your table:
```
```python
from bq_schema.types.type_mapping import Timestamp
from google.cloud.bigquery import TimePartitioning, TimePartitioningType

Expand Down

0 comments on commit aeb9f9f

Please sign in to comment.