I have tried to capture all PowerBI queries while adding the Crate datasource. They are quite long, I have not found a way to attach a file.
select COLUMN_NAME, ORDINAL_POSITION, IS_NULLABLE, case when (data_type like '%unsigned%') then DATA_TYPE || ' unsigned' else DATA_TYPE end as DATA_TYPE
from INFORMATION_SCHEMA.columns
where TABLE_SCHEMA = 'south_mill' and TABLE_NAME = 'processed_data'
order by TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION
select
pkcol.COLUMN_NAME as PK_COLUMN_NAME,
fkcol.TABLE_SCHEMA AS FK_TABLE_SCHEMA,
fkcol.TABLE_NAME AS FK_TABLE_NAME,
fkcol.COLUMN_NAME as FK_COLUMN_NAME,
fkcol.ORDINAL_POSITION as ORDINAL,
fkcon.CONSTRAINT_SCHEMA || '_' || fkcol.TABLE_NAME || '_' || 'var_names' || '_' || fkcon.CONSTRAINT_NAME as FK_NAME
from
(select distinct constraint_catalog, constraint_schema, unique_constraint_schema, constraint_name, unique_constraint_name
from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS) fkcon
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkcol
on fkcon.CONSTRAINT_SCHEMA = fkcol.CONSTRAINT_SCHEMA
and fkcon.CONSTRAINT_NAME = fkcol.CONSTRAINT_NAME
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkcol
on fkcon.UNIQUE_CONSTRAINT_SCHEMA = pkcol.CONSTRAINT_SCHEMA
and fkcon.UNIQUE_CONSTRAINT_NAME = pkcol.CONSTRAINT_NAME
where pkcol.TABLE_SCHEMA = 'south_mill' and pkcol.TABLE_NAME = 'var_names'
and pkcol.ORDINAL_POSITION = fkcol.ORDINAL_POSITION
order by FK_NAME, fkcol.ORDINAL_POSITION
select
pkcol.TABLE_SCHEMA AS PK_TABLE_SCHEMA,
pkcol.TABLE_NAME AS PK_TABLE_NAME,
pkcol.COLUMN_NAME as PK_COLUMN_NAME,
fkcol.COLUMN_NAME as FK_COLUMN_NAME,
fkcol.ORDINAL_POSITION as ORDINAL,
fkcon.CONSTRAINT_SCHEMA || '_' || 'var_names' || '_' || pkcol.TABLE_NAME || '_' || fkcon.CONSTRAINT_NAME as FK_NAME
from
(select distinct constraint_catalog, constraint_schema, unique_constraint_schema, constraint_name, unique_constraint_name
from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS) fkcon
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkcol
on fkcon.CONSTRAINT_SCHEMA = fkcol.CONSTRAINT_SCHEMA
and fkcon.CONSTRAINT_NAME = fkcol.CONSTRAINT_NAME
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkcol
on fkcon.UNIQUE_CONSTRAINT_SCHEMA = pkcol.CONSTRAINT_SCHEMA
and fkcon.UNIQUE_CONSTRAINT_NAME = pkcol.CONSTRAINT_NAME
where fkcol.TABLE_SCHEMA = 'south_mill' and fkcol.TABLE_NAME = 'var_names'
and pkcol.ORDINAL_POSITION = fkcol.ORDINAL_POSITION
order by FK_NAME, fkcol.ORDINAL_POSITION
select i.CONSTRAINT_SCHEMA || '_' || i.CONSTRAINT_NAME as INDEX_NAME, ii.COLUMN_NAME, ii.ORDINAL_POSITION, case when i.CONSTRAINT_TYPE = 'PRIMARY KEY' then 'Y' else 'N' end as PRIMARY_KEY
from INFORMATION_SCHEMA.table_constraints i inner join INFORMATION_SCHEMA.key_column_usage ii on i.CONSTRAINT_SCHEMA = ii.CONSTRAINT_SCHEMA and i.CONSTRAINT_NAME = ii.CONSTRAINT_NAME and i.TABLE_SCHEMA = ii.TABLE_SCHEMA and i.TABLE_NAME = ii.TABLE_NAME
where i.TABLE_SCHEMA = 'south_mill' and i.TABLE_NAME = 'var_names'
and i.CONSTRAINT_TYPE in ('PRIMARY KEY', 'UNIQUE')
order by i.CONSTRAINT_SCHEMA || '_' || i.CONSTRAINT_NAME, ii.TABLE_SCHEMA, ii.TABLE_NAME, ii.ORDINAL_POSITION
select
pkcol.COLUMN_NAME as PK_COLUMN_NAME,
fkcol.TABLE_SCHEMA AS FK_TABLE_SCHEMA,
fkcol.TABLE_NAME AS FK_TABLE_NAME,
fkcol.COLUMN_NAME as FK_COLUMN_NAME,
fkcol.ORDINAL_POSITION as ORDINAL,
fkcon.CONSTRAINT_SCHEMA || '_' || fkcol.TABLE_NAME || '_' || 'processed_data' || '_' || fkcon.CONSTRAINT_NAME as FK_NAME
from
(select distinct constraint_catalog, constraint_schema, unique_constraint_schema, constraint_name, unique_constraint_name
from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS) fkcon
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkcol
on fkcon.CONSTRAINT_SCHEMA = fkcol.CONSTRAINT_SCHEMA
and fkcon.CONSTRAINT_NAME = fkcol.CONSTRAINT_NAME
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkcol
on fkcon.UNIQUE_CONSTRAINT_SCHEMA = pkcol.CONSTRAINT_SCHEMA
and fkcon.UNIQUE_CONSTRAINT_NAME = pkcol.CONSTRAINT_NAME
where pkcol.TABLE_SCHEMA = 'south_mill' and pkcol.TABLE_NAME = 'processed_data'
and pkcol.ORDINAL_POSITION = fkcol.ORDINAL_POSITION
order by FK_NAME, fkcol.ORDINAL_POSITION
select
pkcol.TABLE_SCHEMA AS PK_TABLE_SCHEMA,
pkcol.TABLE_NAME AS PK_TABLE_NAME,
pkcol.COLUMN_NAME as PK_COLUMN_NAME,
fkcol.COLUMN_NAME as FK_COLUMN_NAME,
fkcol.ORDINAL_POSITION as ORDINAL,
fkcon.CONSTRAINT_SCHEMA || '_' || 'processed_data' || '_' || pkcol.TABLE_NAME || '_' || fkcon.CONSTRAINT_NAME as FK_NAME
from
(select distinct constraint_catalog, constraint_schema, unique_constraint_schema, constraint_name, unique_constraint_name
from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS) fkcon
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkcol
on fkcon.CONSTRAINT_SCHEMA = fkcol.CONSTRAINT_SCHEMA
and fkcon.CONSTRAINT_NAME = fkcol.CONSTRAINT_NAME
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkcol
on fkcon.UNIQUE_CONSTRAINT_SCHEMA = pkcol.CONSTRAINT_SCHEMA
and fkcon.UNIQUE_CONSTRAINT_NAME = pkcol.CONSTRAINT_NAME
where fkcol.TABLE_SCHEMA = 'south_mill' and fkcol.TABLE_NAME = 'processed_data'
and pkcol.ORDINAL_POSITION = fkcol.ORDINAL_POSITION
order by FK_NAME, fkcol.ORDINAL_POSITION
select i.CONSTRAINT_SCHEMA || '_' || i.CONSTRAINT_NAME as INDEX_NAME, ii.COLUMN_NAME, ii.ORDINAL_POSITION, case when i.CONSTRAINT_TYPE = 'PRIMARY KEY' then 'Y' else 'N' end as PRIMARY_KEY
from INFORMATION_SCHEMA.table_constraints i inner join INFORMATION_SCHEMA.key_column_usage ii on i.CONSTRAINT_SCHEMA = ii.CONSTRAINT_SCHEMA and i.CONSTRAINT_NAME = ii.CONSTRAINT_NAME and i.TABLE_SCHEMA = ii.TABLE_SCHEMA and i.TABLE_NAME = ii.TABLE_NAME
where i.TABLE_SCHEMA = 'south_mill' and i.TABLE_NAME = 'processed_data'
and i.CONSTRAINT_TYPE in ('PRIMARY KEY', 'UNIQUE')
order by i.CONSTRAINT_SCHEMA || '_' || i.CONSTRAINT_NAME, ii.TABLE_SCHEMA, ii.TABLE_NAME, ii.ORDINAL_POSITION
select
pkcol.COLUMN_NAME as PK_COLUMN_NAME,
fkcol.TABLE_SCHEMA AS FK_TABLE_SCHEMA,
fkcol.TABLE_NAME AS FK_TABLE_NAME,
fkcol.COLUMN_NAME as FK_COLUMN_NAME,
fkcol.ORDINAL_POSITION as ORDINAL,
fkcon.CONSTRAINT_SCHEMA || '_' || fkcol.TABLE_NAME || '_' || 'processed_data' || '_' || fkcon.CONSTRAINT_NAME as FK_NAME
from
(select distinct constraint_catalog, constraint_schema, unique_constraint_schema, constraint_name, unique_constraint_name
from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS) fkcon
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkcol
on fkcon.CONSTRAINT_SCHEMA = fkcol.CONSTRAINT_SCHEMA
and fkcon.CONSTRAINT_NAME = fkcol.CONSTRAINT_NAME
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkcol
on fkcon.UNIQUE_CONSTRAINT_SCHEMA = pkcol.CONSTRAINT_SCHEMA
and fkcon.UNIQUE_CONSTRAINT_NAME = pkcol.CONSTRAINT_NAME
where pkcol.TABLE_SCHEMA = 'south_mill' and pkcol.TABLE_NAME = 'processed_data'
and pkcol.ORDINAL_POSITION = fkcol.ORDINAL_POSITION
order by FK_NAME, fkcol.ORDINAL_POSITION
select
pkcol.TABLE_SCHEMA AS PK_TABLE_SCHEMA,
pkcol.TABLE_NAME AS PK_TABLE_NAME,
pkcol.COLUMN_NAME as PK_COLUMN_NAME,
fkcol.COLUMN_NAME as FK_COLUMN_NAME,
fkcol.ORDINAL_POSITION as ORDINAL,
fkcon.CONSTRAINT_SCHEMA || '_' || 'processed_data' || '_' || pkcol.TABLE_NAME || '_' || fkcon.CONSTRAINT_NAME as FK_NAME
from
(select distinct constraint_catalog, constraint_schema, unique_constraint_schema, constraint_name, unique_constraint_name
from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS) fkcon
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkcol
on fkcon.CONSTRAINT_SCHEMA = fkcol.CONSTRAINT_SCHEMA
and fkcon.CONSTRAINT_NAME = fkcol.CONSTRAINT_NAME
inner join
INFORMATION_SCHEMA.KEY_COLUMN_USAGE pkcol
on fkcon.UNIQUE_CONSTRAINT_SCHEMA = pkcol.CONSTRAINT_SCHEMA
and fkcon.UNIQUE_CONSTRAINT_NAME = pkcol.CONSTRAINT_NAME
where fkcol.TABLE_SCHEMA = 'south_mill' and fkcol.TABLE_NAME = 'processed_data'
and pkcol.ORDINAL_POSITION = fkcol.ORDINAL_POSITION
order by FK_NAME, fkcol.ORDINAL_POSITION
select i.CONSTRAINT_SCHEMA || '_' || i.CONSTRAINT_NAME as INDEX_NAME, ii.COLUMN_NAME, ii.ORDINAL_POSITION, case when i.CONSTRAINT_TYPE = 'PRIMARY KEY' then 'Y' else 'N' end as PRIMARY_KEY
from INFORMATION_SCHEMA.table_constraints i inner join INFORMATION_SCHEMA.key_column_usage ii on i.CONSTRAINT_SCHEMA = ii.CONSTRAINT_SCHEMA and i.CONSTRAINT_NAME = ii.CONSTRAINT_NAME and i.TABLE_SCHEMA = ii.TABLE_SCHEMA and i.TABLE_NAME = ii.TABLE_NAME
where i.TABLE_SCHEMA = 'south_mill' and i.TABLE_NAME = 'processed_data'
and i.CONSTRAINT_TYPE in ('PRIMARY KEY', 'UNIQUE')
order by i.CONSTRAINT_SCHEMA || '_' || i.CONSTRAINT_NAME, ii.TABLE_SCHEMA, ii.TABLE_NAME, ii.ORDINAL_POSITION