analysis.ipynb•1.21 kB
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "3c063413",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Postgres connection OK: 1\n"
]
}
],
"source": [
"import os\n",
"import psycopg\n",
"from dotenv import load_dotenv\n",
"\n",
"load_dotenv()\n",
"\n",
"DATABASE_URL = os.getenv(\"DATABASE_URL\")\n",
"\n",
"if not DATABASE_URL:\n",
" raise ValueError(\"DATABASE_URL environment variable is required\")\n",
"\n",
"conn = psycopg.connect(DATABASE_URL)\n",
"\n",
"with conn.cursor() as cur:\n",
" cur.execute(\"SELECT 1\")\n",
" print(\"✅ Postgres connection OK:\", cur.fetchone()[0])\n"
]
}
],
"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.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}