Reputation: 316
Currently i have a 2 table :
PRODUCTS (which is having PRD_ID, PRD_NAME, PRD_VERSION,PRD_CATEGORY, PRD_PRICE columns) TRANSACTIONS (which is having TR_ID,TR_DATE,TR_LINE_ID,TR_PRD_ID,TR_PRD_QTY column
PRD_ID Is primary key in Products table and TR_ID is primary key in Transactions table. TR_PRD_ID is foreign key representing PRD_ID column from Products table.
I have set up dbt tests in schema.yml file as below:
version: 2
sources:
- name: sources_demo
database: hands_on_demo
schema: seeds_demo
tables:
- name: src_transactions
identifier: TRANSACTIONS
description: "transactions details"
columns:
- name: TR_ID
tests:
- unique
- not_null
- name: TR_LINE_ID
- not_null
- name: TR_PRD_ID
- not_null
- relationships:
to: source('sources_demo','src_products')
field: PRD_ID
- name: TR_PRD_QTY
- not_null
tests:
- unique:
column_name: "TR_ID ||'-'|| TR_LINE_ID"
- name: src_products
identifier: PRODUCTS
description: "All Products details"
columns:
- name: PRD_ID
tests:
- unique
- not_null
- name: PRD_PRICE
tests:
- not_null
- name: PRD_CATEGORY
tests:
- not_null
- accepted_values:
values: ['Charger', 'Mobile', 'SmartWatch']
Every time i am running i am getting below error :
11:47:59 Registered adapter: snowflake=1.7.1
11:47:59 Encountered an error:
Parsing Error
Error reading dbthandson: sources.yml - Runtime Error
Syntax error near line 20
------------------------------
17 | - not_null
18 | - name: TR_PRD_ID
19 | - not_null
20 | - relationships:
21 | to: source('sources_demo','src_products')
22 | field: PRD_ID
23 | - name: TR_PRD_QTY
Raw Error:
------------------------------
mapping values are not allowed in this context
in "<unicode string>", line 20, column 32
what is the issue here ?? What am i doing wrong ?
Upvotes: 0
Views: 18