Closed ablack3 closed 1 year ago
So, this is a similar function that exists in CohortIncidence.
I added temp table mode in this PR., but it also included functionality for strata settings. But if you see what executeAnalysis is doing:
select * from #incidence_summary
A generic flow is:
So, if we do something like this in CIRCE, people need to realize that it's not a simple 'build sql' anymore. There's multiple steps: fetch the results schema DDL as temp tables, replace params to write to temp tables, fetch results from temp tables, clean up temp tables. This library will need functions to support these operations.
Also, in CohortIncidence, it's all or nothing: you can't say some of the tables should be temporary, but others should be permanent . I bring this point up because your request is to have stats tables go into a temporary space, but I assume you mean to leave the cohort table result as a permanent result. To deal with this, we'd still have the results schema all temp, but then you'd have to make a final post-analysis step to copy from the temp results table into a permanent table before dropping the temp tables.
Update: I just read your update to the title, and you do mean to make cohort and stats table temporary.
Thanks @chrisknoll! Very helpful info. This is a request from @edward-burn so I'll let him add context. My understanding is that we would have the option to use temp tables for all cohort and stats tables. It seems like this possible using SQLRender without any changes to Circe but I wanted to check that this is ok to do and if it should be an option when creating the cohort generation sql.
Yes, you can do it by using sqlrender paramaterization, just ensure you're hitting all the right tables (the cohort table is only one of several). It is what would be required if we wanted a 'temp table' mode of the sql generation.
Is it within scope to use temporary tables for cohort and stats tables?
Currently we would need a bit of a hack like
tagging @edward-burn @Tsemharb