fix: Load .env in amenity_radar notebook for database credentials
Some checks failed
CI / lint-and-test (push) Has been cancelled
Some checks failed
CI / lint-and-test (push) Has been cancelled
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,29 +29,7 @@
|
|||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": "import pandas as pd\nfrom sqlalchemy import create_engine\nfrom dotenv import load_dotenv\nimport os\n\n# Load .env from project root\nload_dotenv('../../.env')\n\nengine = create_engine(os.environ.get('DATABASE_URL'))\n\nquery = \"\"\"\nSELECT\n neighbourhood_name,\n parks_index,\n schools_index,\n transit_index,\n amenity_index,\n amenity_tier\nFROM public_marts.mart_neighbourhood_amenities\nWHERE year = (SELECT MAX(year) FROM public_marts.mart_neighbourhood_amenities)\nORDER BY amenity_index DESC\n\"\"\"\n\ndf = pd.read_sql(query, engine)\nprint(f\"Loaded {len(df)} neighbourhoods\")"
|
||||||
"import pandas as pd\n",
|
|
||||||
"from sqlalchemy import create_engine\n",
|
|
||||||
"import os\n",
|
|
||||||
"\n",
|
|
||||||
"engine = create_engine(os.environ.get('DATABASE_URL', 'postgresql://portfolio:portfolio@localhost:5432/portfolio'))\n",
|
|
||||||
"\n",
|
|
||||||
"query = \"\"\"\n",
|
|
||||||
"SELECT\n",
|
|
||||||
" neighbourhood_name,\n",
|
|
||||||
" parks_index,\n",
|
|
||||||
" schools_index,\n",
|
|
||||||
" transit_index,\n",
|
|
||||||
" amenity_index,\n",
|
|
||||||
" amenity_tier\n",
|
|
||||||
"FROM public_marts.mart_neighbourhood_amenities\n",
|
|
||||||
"WHERE year = (SELECT MAX(year) FROM public_marts.mart_neighbourhood_amenities)\n",
|
|
||||||
"ORDER BY amenity_index DESC\n",
|
|
||||||
"\"\"\"\n",
|
|
||||||
"\n",
|
|
||||||
"df = pd.read_sql(query, engine)\n",
|
|
||||||
"print(f\"Loaded {len(df)} neighbourhoods\")"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
|
|||||||
Reference in New Issue
Block a user