diff --git a/.gitignore b/.gitignore index 1a749fa..22a6e5c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,7 @@ __pycache__/ _local # Output directory of the package itself -**/output -**/target/bq2dbt +/target # Distribution / packaging build/ diff --git a/README.md b/README.md index ef21da7..3df80b8 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,14 @@ I know this looks like something the codegen dbt package could do, but it was fa We used this script to convert an existing project with missing contracts and with `SELECT *` statements to something for robust and implicit, and with existing tables in BigQuery. This is the main purpose of this. -# Install the script localy +# Instal from source -Just use pip: + +``` +pip install . +``` + +# Install from Github ``` # Latest version diff --git a/bq2dbt/bq2dbt.py b/bq2dbt/bq2dbt.py index f383a30..c631bcd 100755 --- a/bq2dbt/bq2dbt.py +++ b/bq2dbt/bq2dbt.py @@ -128,11 +128,13 @@ def bq2dbt(): "description": field.description or "" } if field.is_nullable == 'NO': - field_info = {**field_info, **{ - "constraints": [ - {"type": "not_null"} - ] - }} + # BigQuery says array cannot be null, but they can and they don't support not_null constraint + if data_type not in ['ARRAY']: + field_info = {**field_info, **{ + "constraints": [ + {"type": "not_null"} + ] + }} yaml_data["models"][0]["columns"].append(field_info) if '.' not in field.field_path: