diff --git a/cumulus_library/__init__.py b/cumulus_library/__init__.py index 7f7ca9a..542bf51 100644 --- a/cumulus_library/__init__.py +++ b/cumulus_library/__init__.py @@ -4,6 +4,17 @@ from cumulus_library.builders.base_table_builder import BaseTableBuilder from cumulus_library.builders.counts import CountsBuilder from cumulus_library.study_manifest import StudyManifest +from cumulus_library.template_sql.base_templates import get_template -__all__ = ["BaseTableBuilder", "CountsBuilder", "StudyConfig", "StudyManifest"] +# A note about the `get_template` function: +# As of this writing, the get_template function is used internally by the +# Cumulus team across multiple study repos for creating SQL in databases, both +# from the templates in this repo and in the various other projects (while leveraging +# some of our syntax helper macros, which are auto loaded by this function). +# Breaking changes to these templates will result in a major version bump. + +# This API should be usable for your own study efforts - but the documentation +# is all code level. See template_sql for more information. + +__all__ = ["BaseTableBuilder", "CountsBuilder", "StudyConfig", "StudyManifest", "get_template"] __version__ = "4.2.0" diff --git a/cumulus_library/template_sql/base_templates.py b/cumulus_library/template_sql/base_templates.py index 766f15c..954e148 100644 --- a/cumulus_library/template_sql/base_templates.py +++ b/cumulus_library/template_sql/base_templates.py @@ -19,6 +19,8 @@ class TableView(enum.Enum): def get_base_template(*args, **kwargs): """Legacy wrapper for get_template""" + # TODO: Isolate this as sole library entrypoint after cutting over studies to use + # the public get_template return get_template(*args, **kwargs) diff --git a/tests/test_data/study_python_counts_valid/module1.py b/tests/test_data/study_python_counts_valid/module1.py index e173364..37223e8 100644 --- a/tests/test_data/study_python_counts_valid/module1.py +++ b/tests/test_data/study_python_counts_valid/module1.py @@ -4,9 +4,6 @@ class ModuleOneRunner(cumulus_library.CountsBuilder): display_text = "module1" - def __init__(self, *args, **kwargs): - super().__init__(study_prefix="study_python_counts_valid") - def prepare_queries(self, *args, **kwargs): self.queries.append( "CREATE TABLE IF NOT EXISTS study_python_counts_valid__table1 (test int);" diff --git a/tests/test_data/study_python_counts_valid/module2.py b/tests/test_data/study_python_counts_valid/module2.py index e785662..c78feda 100644 --- a/tests/test_data/study_python_counts_valid/module2.py +++ b/tests/test_data/study_python_counts_valid/module2.py @@ -4,9 +4,6 @@ class ModuleTwoRunner(cumulus_library.CountsBuilder): display_text = "module2" - def __init__(self, *args, **kwargs): - super().__init__(study_prefix="study_python_counts_valid") - def prepare_queries(self, *args, **kwargs): self.queries.append( "CREATE TABLE IF NOT EXISTS study_python_counts_valid__table2 (test int);"