Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fraud detection demo instructions to use federated query and materialized view #11

Merged
Prev Previous commit
Next Next commit
Update deprecated trinio dbapi connection
  • Loading branch information
aceriverson committed Aug 8, 2023
commit bf64e0c330a349746dbc78bc28620d84ea9aa16f
14 changes: 9 additions & 5 deletions Notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"import seaborn as sns\n",
"import boto3\n",
"\n",
"from sqlalchemy import create_engine, text\n",
"import trino.sqlalchemy\n",
"from trino.dbapi import connect\n",
"\n",
"import sklearn\n",
"from sklearn.metrics import confusion_matrix\n",
Expand Down Expand Up @@ -126,8 +125,13 @@
"outputs": [],
"source": [
"# Connect sqlalchemy to Starburst\n",
"engine = create_engine(\"trino://[email protected]:8080/\")\n",
"conn = engine.connect()"
"conn = connect(\n",
" host=\"coordinator.starburst.svc.cluster.local\",\n",
" port=8080,\n",
" user=\"user\",\n",
" catalog=\"s3\",\n",
" schema=\"fraud\",\n",
")"
]
},
{
Expand All @@ -141,7 +145,7 @@
},
"outputs": [],
"source": [
"raw_df = pd.read_sql(text(\"SELECT * FROM s3.fraud.data\"), conn)\n",
"raw_df = pd.read_sql(\"SELECT * FROM s3.fraud.data\", conn)\n",
"raw_df = raw_df.drop(\"id\", axis=1) # Remove \"id\" column for model training"
]
},
Expand Down