2024-11-21 11:36:30 +01:00
|
|
|
{
|
|
|
|
|
"cells": [
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"This is a template for general jupyter notebooks."
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2025-06-10 05:59:12 +00:00
|
|
|
"execution_count": null,
|
2024-11-21 11:36:30 +01:00
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
2025-06-10 05:59:12 +00:00
|
|
|
"# This script connects to a Data Warehouse (DWH) using PostgreSQL. \n",
|
|
|
|
|
"# This should be common for all Notebooks, but you might need to adjust the path to the `dwh_utils` module.\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"import sys\n",
|
|
|
|
|
"import os\n",
|
|
|
|
|
"sys.path.append(os.path.abspath(\"./utils\")) # Adjust path if needed\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"from dwh_utils import read_credentials, create_postgres_engine, query_to_dataframe, test_connection\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# --- Connect to DWH ---\n",
|
|
|
|
|
"creds = read_credentials()\n",
|
|
|
|
|
"dwh_pg_engine = create_postgres_engine(creds)\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"# --- Test Query ---\n",
|
|
|
|
|
"test_connection()\n"
|
2024-11-21 11:36:30 +01:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"kernelspec": {
|
|
|
|
|
"display_name": "venv",
|
|
|
|
|
"language": "python",
|
|
|
|
|
"name": "python3"
|
|
|
|
|
},
|
|
|
|
|
"language_info": {
|
|
|
|
|
"codemirror_mode": {
|
|
|
|
|
"name": "ipython",
|
|
|
|
|
"version": 3
|
|
|
|
|
},
|
|
|
|
|
"file_extension": ".py",
|
|
|
|
|
"mimetype": "text/x-python",
|
|
|
|
|
"name": "python",
|
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
|
"pygments_lexer": "ipython3",
|
|
|
|
|
"version": "3.12.3"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"nbformat": 4,
|
|
|
|
|
"nbformat_minor": 2
|
|
|
|
|
}
|