-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathconfig.py
More file actions
65 lines (57 loc) · 2.1 KB
/
config.py
File metadata and controls
65 lines (57 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# minds/tests/integration/config.py
import logging
import os
from dotenv import load_dotenv
# ===================================================================
# 1. CONFIGURATION
# ===================================================================
# Set up basic logging to output INFO level messages.
logging.basicConfig(
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
)
# Load environment variables from a .env file if it exists.
load_dotenv()
# --- API and Schema Configuration ---
MINDS_API_BASE_URL = os.getenv("MINDS_API_BASE_URL") #
MINDS_OPENAPI_SPEC_URL = os.getenv(
"MINDS_OPENAPI_SPEC_URL", f"{MINDS_API_BASE_URL.strip('/')}/openapi.json"
)
AUTH_TOKEN = os.getenv("MINDS_API_TOKEN")
# --- DATASOURCE CONFIGURATIONS ---
DATASOURCE_CONFIGS = []
# --- PostgreSQL Configuration (Reads from your existing PG_ environment variables) ---
POSTGRES_CONFIG = {
"host": os.getenv("PG_HOST", "samples.mindsdb.com"),
"port": int(os.getenv("PG_PORT", 5432)),
"user": os.getenv("PG_USER", "demo_user"),
"password": os.getenv("PG_PASSWORD", "demo_password"),
"database": os.getenv("PG_DB_NAME", "demo"),
"schema": os.getenv("PG_SCHEMA", "demo"),
}
if all(POSTGRES_CONFIG.values()):
DATASOURCE_CONFIGS.append(
{
"engine": "postgres",
"name_prefix": "test_pg_ds",
"connection_data": POSTGRES_CONFIG,
"sample_table": "house_sales", # A known table in the demo PG database
}
)
# --- Snowflake Configuration (Only enabled if all credentials are provided) ---
SNOWFLAKE_CONFIG = {
"account": os.getenv("SNOWFLAKE_ACCOUNT"),
"user": os.getenv("SNOWFLAKE_USER"),
"password": os.getenv("SNOWFLAKE_PASSWORD"),
"schema": os.getenv("SNOWFLAKE_SCHEMA"),
"database": os.getenv("SNOWFLAKE_DATABASE"),
"warehouse": os.getenv("SNOWFLAKE_WAREHOUSE"),
}
if all(SNOWFLAKE_CONFIG.values()):
DATASOURCE_CONFIGS.append(
{
"engine": "snowflake",
"name_prefix": "test-sf-ds",
"connection_data": SNOWFLAKE_CONFIG,
"sample_table": "CUSTOMER",
}
)