You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you should now see the file structure of the VM inside a Jupyter notebook in your browser
Creating a new notebook so you can start writing scripts and connect to the DB
Create a new notebook
Click the 'new' tab on the right side of the page
select the '[conda env:data-science]' notebook option
You should now have a notebook open with one cell inside it.
Add the snippet below to the notebook's cell to test the DB connection
importpsycopg2importpandasaspd# enter the values below from your VM, the defaults are already set change if neededDATABASE='postgres'USER='turkey'PASSWORD='ORturkeyeggs'# makes connection to DBconn=psycopg2.connect(database=DATABASE, user=USER, password=PASSWORD, host='localhost', port=5432)
# use pandas to query postgres and create a dataframepd.read_sql_query('SELECT * FROM information_schema.information_schema_catalog_name;', con=conn)
After adding the above code the the first cell in your notebook and running it you should see this output: