Skip to main content

Execute SQL queries on data present in CSV or Excel files. Also allows to generate the query output files.

Project description

queryeasy

Execute SQL queries on data present in CSV or Excel files. Also allows to generate the query output files.

Features

  • Query the CSV or Excel files using sql queries
  • Provides the option to store the query output to .xls, .xlsx, .csv formats
  • Formats the output to fit in the terminal
  • Removes the spaces from the column headers to ease query process
  • Saves the output file to default dir if no path is specified

Installation

You can pip install the package using

pip install queryeasy

The command line utility will be installed as queryeasy to bin on Linux (e.g. /usr/bin); or as queryeasy.exe to Scripts in your Python installation on Windows (e.g. C:\Python3\Scripts\tabulate.exe).

After installing, check the version

queryeasy --version

Usage

queryeasy [-h] [-s sheet_name] [-o output_file] [-v] filename sql_query

It can be used to execute sql queries on csv file

queryeasy sample.csv "select * from sample"

It can be used to execute sql queries on excel file

queryeasy sample.xls "select * from sample" -s Sheet1
queryeasy sample.xlsx "select * from sample" -s Sheet3

The output of the performed query can be saved to a csv or excel file

queryeasy sample.xls "select * from sample" -s Sheet1 -o /path/output.xls
queryeasy sample.xlsx "select * from sample" -s Sheet3 -o /path/output.xlsx
queryeasy sample.xlsx "select * from sample" -s Sheet3 -o output.xlsx
queryeasy sample.csv "select * from sample" -s Sheet3 -o /path/output.csv
queryeasy sample.csv "select * from sample" -s Sheet3 -o output

Arguments

positional arguments: 
  filename              Enter the file path/name
  sql_query             Enter the SQL query

optional arguments:
  -h, --help            show this help message and exit
  -s sheet_name, --sheet sheet_name
                        Provide the sheet name for excel file
  -o output_file, --output output_file
                        Output file path/name to store results
  -v, --version         show program's version number and exit

Notes

  • Table names used in the SQL query should match the input CSV/Excel file names, without the ".csv" or ".xls" extension
  • While entering query, replace the spaces in column names with underscore(_)
  • The default output file extension is .csv
  • The output file supports ".xlsx", ".xls", ".csv" extensions as of now

Contribute

The library is in initial stage and requires a lot of work, please feel free to contribute

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

queryeasy-0.0.4.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

queryeasy-0.0.4-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page