The library can take any pandas dataframe and you should be able to run SQL on top of dataframe then. pandas already provides a nice way of working with dataset. sqlpandas is an initiative to bring pandas to SQL folks too.
- CSV
- JSON
- Other files must first be read using
pandasand then should be added tosqlpandasinstance
- Example for adding dataset to sql object
import pandas as pd
from sqlpandas.parser import PandasSql
sql = PandasSql()
df1 = pd.read_csv("C:\\Users\\puneet\\PycharmProjects\\sqlpandas\\sample_files\\test.txt")
sql.add_df(df1)
dta = sql.sql("select * from df where b > 3 order by d")- Examaple for reading CSV and then querying
import pandas as pd
from sqlpandas.parser import PandasSql
sql = PandasSql()
sql.read_file("C:\\Users\\puneet\\PycharmProjects\\sqlpandas\\sample_files\\test.txt")
dta = sql.sql("select * from df where b > 3 order by d")