It appears that the new schema functionally does not work within the Table Group, where the schema is required to be explicit in the Table Group definition. Here is some valid dbml:
// this is a test scenario
Project test_scenario_1 {
Note: '''
test scenario for schema management
'''
}
Table test.sales {
sales_id int [primary key]
calendar_date date [not null]
quantity integer [not null]
sales_amount decimal [not null]
account_owner_employee_id int [not null]
sales_rep_employee_id int [not null]
}
Table test.employee as emp {
employee_id int [primary key]
employee_name string [not null]
manager_employee_id int [not null]
country_code string [null]
title_id string [null]
}
Table test.country as cnt {
country_code string [primary key]
country_name string [unique, not null]
}
Table test.title {
title_id string [primary key]
title_name string [not null]
}
Ref sales_refs_employee__account_owner {
test.sales.account_owner_employee_id > test.employee.employee_id
}
Ref sales_refs_employee__sales_rep {
test.sales.sales_rep_employee_id > test.employee.employee_id
}
Ref employee_refs_employee__manager {
test.employee.manager_employee_id > test.employee.employee_id
}
Ref employee_refs_country {
test.employee.country_code > test.country.country_code
}
Ref employee_refs_title__current {
test.employee.title_id > test.title.title_id
}
Table test.calendar {
calendar_date date [not null]
fiscal_month int [not null]
}
Ref sales_refs_calendar {
test.sales.calendar_date > test.calendar.calendar_date
}
Tablegroup test_table_group_1 {
test.sales
test.employee
test.country
test.title
test.calendar
}
It will yield an error due to pydbml/definitions/table_group.py, I believe.
File "~git~/venv/lib/python3.8/site-packages/pydbml/parser/parser.py", line 175, in locate_table
raise TableNotFoundError(f'Table {full_name} not present in the database')
pydbml.exceptions.TableNotFoundError: Table ['test', 'sales'].test not present in the database
If we remove the Table Group, the schema in the below parses normally.
// this is a test scenario
Project test_scenario_1 {
Note: '''
test scenario for schema management
'''
}
Table test.sales {
sales_id int [primary key]
calendar_date date [not null]
quantity integer [not null]
sales_amount decimal [not null]
account_owner_employee_id int [not null]
sales_rep_employee_id int [not null]
}
Table test.employee as emp {
employee_id int [primary key]
employee_name string [not null]
manager_employee_id int [not null]
country_code string [null]
title_id string [null]
}
Table test.country as cnt {
country_code string [primary key]
country_name string [unique, not null]
}
Table test.title {
title_id string [primary key]
title_name string [not null]
}
Ref sales_refs_employee__account_owner {
test.sales.account_owner_employee_id > test.employee.employee_id
}
Ref sales_refs_employee__sales_rep {
test.sales.sales_rep_employee_id > test.employee.employee_id
}
Ref employee_refs_employee__manager {
test.employee.manager_employee_id > test.employee.employee_id
}
Ref employee_refs_country {
test.employee.country_code > test.country.country_code
}
Ref employee_refs_title__current {
test.employee.title_id > test.title.title_id
}
Table test.calendar {
calendar_date date [not null]
fiscal_month int [not null]
}
Ref sales_refs_calendar {
test.sales.calendar_date > test.calendar.calendar_date
}
It appears that the new schema functionally does not work within the Table Group, where the schema is required to be explicit in the Table Group definition. Here is some valid dbml:
It will yield an error due to
pydbml/definitions/table_group.py
, I believe.If we remove the Table Group, the schema in the below parses normally.