<@U04SE163WC8> where can I find the code for the n...
# replication-ask-ai
p
@kapa.ai where can I find the code for the normalization tables of a bigquery connection
k
The code for the normalization tables of a BigQuery connection can be found in the dbt code that Airbyte generates. Here are the steps to extract the generated dbt code: 1. Go to the connection file and open the latest successful job. Note down the folder that the process ran in from the top section of the log. For example, it could be
/tmp/workspace/1/0
with
1
corresponds to the Airbyte job_id, and
0
to the attempt_id. 2. Create an environment variable for the workspace folder. For example:
Copy code
bash NORMALIZE_WORKSPACE="1/0"
Alternatively, you can run the following command to get the workspace folder for the latest job:
Copy code
bash NORMALIZE_WORKSPACE=`docker run --rm -i -v airbyte_workspace:/data  busybox find /data -path "*normalize/models*" | sed -E "s;/data/([0-9]+/[0-9]+/)normalize/.*;\1;g" | sort | uniq | tail -n 1`
3. Verify that the project is configured correctly by running:
Copy code
bash #!/usr/bin/env bash docker run --rm -i -v airbyte_workspace:/data -w /data/$NORMALIZE_WORKSPACE/normalize --network host --entrypoint /usr/local/bin/dbt airbyte/normalization debug --profiles-dir=. --project-dir=.
4. Extract the generated dbt code to an external directory. Replace the
PROJECT_PATH
variable with your desired path:
Copy code
bash #!/usr/bin/env bash  PROJECT_PATH="$(pwd)/covid-data" rm -rf $PROJECT_PATH/ mkdir -p $PROJECT_PATH  docker cp airbyte-server:/tmp/workspace/$NORMALIZE_WORKSPACE/normalize/. $PROJECT_PATH  NORMALIZE_DIR=$PROJECT_PATH/normalization-files/normalize cd $NORMALIZE_DIR ls
You can find more details in this [tutorial](https://airbyte.com/tutorials/bigquery-partition-cluster).