You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using OUH Data Warehouse module and have generated a query that is missing a primary key. Note that foreign keys are not setup in this Data Model and could be the cause of the issue. We need to address this somehow to avoid generating corrupt SQL.
IF OBJECT_ID(N'tempdb..#cohort') IS NOT NULL
DROP TABLE [#cohort]
GO
CREATE TABLE [#cohort] ( // This should have a PERSON_ID field
)
GO
INSERT INTO [#cohort] (
)
SELECT // This should have [Inpatient].[INP_GENERAL].[PERSON_ID]
FROM
[Inpatient].[INP_GENERAL]
WHERE
[Inpatient].[INP_GENERAL].[PERSON_ID] > '1'
AND (
[EDEscalation].[BREAKDOWN].[Stream] < '2024-09-21T15:45'
)
GO
SELECT
[EDEscalation].[BREAKDOWN].[RUNTIME],
...
FROM
[EDEscalation].[BREAKDOWN] // Note, no join here because lack of foreign keys. That is correct.
GO
SELECT
[Inpatient].[INP_GENERAL].[PERSON_ID]
FROM
[Inpatient].[INP_GENERAL] // I would expect this to join to the cohort query though.
GO
IF OBJECT_ID(N'tempdb..#cohort') IS NOT NULL
DROP TABLE [#cohort]
GO
Steps to reproduce
e.g.
Use the OUH Data Warehouse - modules database
Set the core table to be: Inpatient.INP_GENERAL
Set the element PATIENT_ID in [Inpatient].[INP_GENERAL] to be a primary key.
Description
I am using OUH Data Warehouse module and have generated a query that is missing a primary key. Note that foreign keys are not setup in this Data Model and could be the cause of the issue. We need to address this somehow to avoid generating corrupt SQL.
Steps to reproduce
e.g.
Inpatient.INP_GENERALExpected behaviour
The query should be created successfully