<jupyter_start><jupyter_text>How to Load SQL Files  CURD=Create Update Read Delete<jupyter_code>import pandas as pd
import sqlite3
con=sqlite3.connect("Desktop/weather_2012.sqlite")
con
df=pd.read_sql("SELECT * from weather_2012 LIMIT 3",con)
df
df=pd.read_sql("SELECT * from weather_2012 LIMIT 3",con,index_col='id')
df
df=pd.read_sql("SELECT * from weather_2012",con,index_col='id')
df
df.columns
weather_df=pd.read_csv('https://raw.githubusercontent.com/reddyprasade/Data-Sets-For-Machine-Learnig-and-Data-Science/master/DataSets/weather_2012.csv')
weather_df.head()
con = sqlite3.connect("Desktop/test_db.sqlite")
con
con.execute("DROP TABLE IF EXISTS weather_2012")
weather_df.to_sql("weather_2012",con)
con = sqlite3.connect("Desktop/test_db.sqlite")
df=pd.read_sql("SELECT * from weather_2012 LIMIT 3",con)
df
con = sqlite3.connect("Desktop/test_db.sqlite")
df=pd.read_sql("SELECT * from weather_2012 ORDER By Weather",con)
df<jupyter_output><empty_output><jupyter_text>Connecting to other kinds of database<jupyter_code>import MySQLdb
con=MySQLdb.connect(host='localhost',db='test')<jupyter_output><empty_output><jupyter_text>To connect to a postgre SQL database<jupyter_code>import psycopg2
con=psycopg2.connect(host='localhost')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12933753943217666, 'fraction_numerical': 0.03627760252365931, 'mean_word_length': 9.071428571428571, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '654565', 'license': 'MIT', 'n_tokens_mistral': 509, 'n_tokens_neox': 457, 'n_words': 76, 'path': 'Loading of sql files.ipynb', 'repo_name': 'bharath1604/pandas', 'size': '1268'}