detquantlib 5.1.0__tar.gz → 5.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {detquantlib-5.1.0 → detquantlib-5.1.1}/PKG-INFO +1 -1
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/data/databases/detdatabase.py +15 -9
- {detquantlib-5.1.0 → detquantlib-5.1.1}/pyproject.toml +1 -1
- {detquantlib-5.1.0 → detquantlib-5.1.1}/LICENSE.txt +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/README.md +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/assets/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/assets/battery.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/assets/wind_turbine.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/converters/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/converters/definitions.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/converters/energy.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/converters/helpers.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/converters/price.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/data/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/data/databases/helpers.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/data/entsoe/entsoe.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/data/sftp/sftp.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/dates/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/dates/dates.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/figures/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/figures/plotly_figures.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/forecasting/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/forecasting/forecasting.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/outputs/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/outputs/outputs_interface.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/stats/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/stats/data_analysis.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/tradable_products/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/tradable_products/tradable_products.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/utils/__init__.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/utils/logging.py +0 -0
- {detquantlib-5.1.0 → detquantlib-5.1.1}/detquantlib/utils/utils.py +0 -0
|
@@ -35,26 +35,32 @@ class DetDatabase:
|
|
|
35
35
|
initialized.
|
|
36
36
|
driver: ODBC driver
|
|
37
37
|
"""
|
|
38
|
-
# Store database name if it is provided
|
|
39
|
-
if db_name:
|
|
40
|
-
os.environ["DET_DB_NAME"] = db_name
|
|
41
|
-
|
|
42
38
|
# Only allow object creation if mandatory environment variables exist
|
|
43
|
-
|
|
39
|
+
skip_db_name = db_name is not None
|
|
40
|
+
DetDatabase.check_environment_variables(skip_db_name)
|
|
44
41
|
|
|
42
|
+
self.db_name = db_name if db_name else os.environ["DET_DB_NAME"]
|
|
45
43
|
self.driver = driver
|
|
46
44
|
self.engine = engine if engine is not None else self.initialize_engine()
|
|
47
45
|
|
|
48
46
|
@staticmethod
|
|
49
|
-
def check_environment_variables():
|
|
47
|
+
def check_environment_variables(skip_db_name: bool):
|
|
50
48
|
"""
|
|
51
49
|
Checks if environment variables needed by the class are defined.
|
|
52
50
|
|
|
51
|
+
Args:
|
|
52
|
+
skip_db_name: If true, does not check if the environment variable containing the
|
|
53
|
+
database name is defined
|
|
54
|
+
|
|
53
55
|
Raises:
|
|
54
56
|
ConnectionError: Raises an error if environment variables are not defined.
|
|
55
57
|
"""
|
|
56
|
-
required_env_vars =
|
|
57
|
-
|
|
58
|
+
required_env_vars = (
|
|
59
|
+
[]
|
|
60
|
+
if skip_db_name
|
|
61
|
+
else [dict(name="DET_DB_NAME", value=None, description="Database name")]
|
|
62
|
+
)
|
|
63
|
+
required_env_vars += [
|
|
58
64
|
dict(name="DET_DB_SERVER", value=None, description="Server name"),
|
|
59
65
|
dict(name="DET_DB_USERNAME", value=None, description="Username"),
|
|
60
66
|
dict(name="DET_DB_PASSWORD", value=None, description="Password"),
|
|
@@ -81,7 +87,7 @@ class DetDatabase:
|
|
|
81
87
|
connection_str = (
|
|
82
88
|
f"DRIVER={self.driver};"
|
|
83
89
|
f"SERVER={os.getenv('DET_DB_SERVER')};"
|
|
84
|
-
f"DATABASE={
|
|
90
|
+
f"DATABASE={self.db_name};"
|
|
85
91
|
f"UID={os.getenv('DET_DB_USERNAME')};"
|
|
86
92
|
f"PWD={quote_plus(os.getenv('DET_DB_PASSWORD'))}"
|
|
87
93
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|