Skip to content

Instantly share code, notes, and snippets.

@kshirsagarsiddharth
Created March 15, 2022 12:05
Show Gist options
  • Save kshirsagarsiddharth/55ab0e0b00bb505ec4d1e04f3a181993 to your computer and use it in GitHub Desktop.
Save kshirsagarsiddharth/55ab0e0b00bb505ec4d1e04f3a181993 to your computer and use it in GitHub Desktop.
con
# I have stored my credentials in a json file
import json
import pandas as pd
import plotly.express as px
with open("creds.json","r") as f:
creds = json.load(f)
# my username
user = creds['user']
# my password
password = creds['password']
# name of my database
database_name = 'order_factory'
# Defining A connection string and making a connection
########################################################################
%load_ext sql
connection_string = f"mysql://{user}:{password}@localhost/{database_name}"
%sql $connection_string
########################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment