Skip to content

Commit 2c8a526

Browse files
committed
test: CI/CD
Initial version with schemaless Initial version with schemaless add partition when schemaless black initial commit with infer schema initial commit with infer schema : handle json msg not dict initial commit with infer schema : handle json msg not dict initial commit with infer schema : one generator by row initial commit with infer schema : one generator by row rollback infer schema and clean integration of schemaless process remove unused var initial commit with infer_schema limit errors count add schemaless and infer_schema doc fix index out of range reduce info messages fix python format
1 parent 9f6d29e commit 2c8a526

File tree

5 files changed

+234
-59
lines changed

5 files changed

+234
-59
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@ sample [target-config.json](/sample_config/target-config-exchange-rates-api.json
154154
* `truncate`: Deleting all previous rows and uploading the new ones to the table
155155
* `incremental`: **Upserting** new rows into the table, using the **primary key** given by the tap connector
156156
(if it finds an old row with same key, updates it. Otherwise it inserts the new row)
157+
* `schemaless` create table with unique column `record` this parameter is usful in case data source is schemaless like `mongodb`
158+
* `infer_schema` this parameter create new tables `_sdc_schema` with infered schema from input records : this is a better alternative to schema received from tap
157159
- WARNING: We do not recommend using `incremental` option (which uses `MERGE` SQL statement). It might result in loss of production data, because historical records get updated. Instead, we recommend using the `append` replication method, which will preserve historical data.
158160

161+
159162
Sample **target-config.json** file:
160163

161164
```
@@ -166,7 +169,9 @@ Sample **target-config.json** file:
166169
"validate_records": true,
167170
"add_metadata_columns": true,
168171
"location": "EU",
169-
"table_config": "target-tables-config.json"
172+
"table_config": "target-tables-config.json",
173+
"schemaless": true,
174+
"infer_schema": true
170175
}
171176
```
172177

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
singer-python~=5.12.2
22
google-cloud-bigquery~=3.3.5
33
jsonschema~=2.6.0
4-
setuptools~=65.5.0
4+
setuptools~=65.5.0
5+
bigquery_schema_generator==1.4.1

target_bigquery/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def main():
7474
location = config.get("location", "US")
7575
validate_records = config.get("validate_records", True)
7676
add_metadata_columns = config.get("add_metadata_columns", True)
77+
schemaless = config.get("schemaless", False)
78+
infer_schema = config.get("infer_schema", False)
7779

7880
# we can pass merge state option via CLI param
7981
merge_state_messages_cli = flags.merge_state_messages
@@ -125,6 +127,8 @@ def main():
125127
table_prefix=table_prefix,
126128
table_suffix=table_suffix,
127129
add_metadata_columns=add_metadata_columns,
130+
schemaless=schemaless,
131+
infer_schema=infer_schema,
128132
table_configs=table_configs,
129133
max_cache=max_cache
130134
)

target_bigquery/process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def process(
5656
yield s
5757

5858
elif isinstance(msg, singer.StateMessage):
59-
logger.info("Updating state with {}".format(msg.value))
59+
logger.debug("Updating state with {}".format(msg.value))
6060
for s in handler.handle_state_message(msg):
6161
logger.info(f"Pushing state: {s}")
6262
yield s

0 commit comments

Comments
 (0)