CREATE VIEW drh_raw_cgm_table_lst AS
SELECT
(
SELECT
party_id
FROM
party
LIMIT
1
) AS tenant_id,
(
SELECT
study_id
FROM
uniform_resource_study
LIMIT
1
) AS study_id,
name,
tbl_name AS table_name,
files.file_name || '.' || files.file_format as raw_cgm_file_name
FROM
sqlite_master
LEFT JOIN drh_study_files_table_info files ON lower(files.table_name) = lower(tbl_name)
WHERE
type = 'table' and name LIKE 'uniform_resource_cgm_tracing%'