Loading repository data…
Loading repository data…
pablominue / repository
PySQLTools tries to ease the interaction between Python and SQL. The idea behind this project is to provide an easy framework to manage the interaction between this two languages. It allows dynamic queries management, using parameters in the SQL queries that can be later easily manipulated with the provided tools.
PySQLTools tries to ease the interaction between Python and SQL. The idea behind this project is to provide an easy framework to manage the interaction between this two languages. It allows dynamic queries management, using parameters in the SQL queries that can be later easily manipulated with the provided tools.
you can install the latest distribution by
pip install pysqltools
The query module provides a Query class to work with Query objects, which will allow to modify the SQL Queries on an easy way with the class methods, and easily access the sql string with the sql attribute of the objects.
To add parameters to the query, use {{parameter}} on the SQL String.
The current methods are:
select * from {{table_param}} limit 20function call:
query = Query(sql = sql).format(table_param = "MyTable")
More to be developed. For now, it contains a Generator generate_insert_query twith the following inputs:
The Generator yields Insert Queries (with batch_size rows) that can be iterated to execute.
Allows to create tables on a SQL Database given a pandas DataFrame. Also contains the option to insert the data of the dataframe in the new table by calling the insert module
Contains the function delete_from_dataframe. This function allows to generate a Query object that will contain a SQL to delete all the rows in the
target table that meet the conditions on the dataframe rows