Articles → PANDAS → read_sql function in pandas

read_sql function in pandas






Purpose





Installing sqlalchemy




pip install sqlalchemy



Example






import pandas as pd
from sqlalchemy import create_engine


engine = create_engine("sqlite:///c:\sqlite\SchoolDB.db")
engine.connect()


df = pd.DataFrame()
df = pd.read_sql('select * from Departments', con=engine)
print(df)



Output



Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, June 04, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250