Skip to main content

From SQL queries to pandas DataFrames: QueryPanda makes it easy to retrieve, aggregate, and save data from PostgreSQL, enhancing data analysis and machine learning projects.

Project description

Query2Dataframe Project

Query2DataFrame Logo

Overview

This project provides a toolkit for retrieving, saving, and loading datasets from a PostgreSQL database, aimed at simplifying data handling and preprocessing tasks for data analysis and machine learning projects. It includes functionality to ensure robust data retrieval processes, including handling checkpoints for long-running data retrieval tasks and saving data in various formats.

Features

  • Retrieve data from a PostgreSQL database with customizable query templates.
  • Save retrieved data in different formats (CSV, PKL, Excel) with checkpointing to manage long-running tasks.
  • Load datasets from saved files into pandas DataFrames, supporting various file formats.
  • Modular design for easy integration into data processing pipelines.

Installation

To use this project, you need to have Python installed on your machine. It is recommended to use Python 3.8 or higher.

  1. Clone the repository:
      git clone (https://github.com/Shazankk/Query2DataFrame)
      cd Query2DataFrame

Install required libraries: Ensure you have pip installed and then run:

      pip install -r requirements.txt

Configure database connection: Modify the config.json file with your PostgreSQL database connection details:

{
  "database": {
    "user": "your_username",
    "password": "your_password",
    "host": "database_host",
    "database": "your_database",
    "sslmode": "require"
  }
}

Update the placeholders with your actual database connection details.

Usage

Example Usage Script

See example_usage.py for a detailed example on how to use the toolkit. This script demonstrates:

  • Loading database connection configurations from config.json.
  • Constructing a SQL query with placeholders for date ranges.
  • Retrieving and saving datasets for specified time periods.
  • Loading datasets from saved files.

Data Retrieval and Saving

You can customize data retrieval by modifying the SQL query template, specifying start and end times, and choosing your data saving and aggregation preferences.

Loading Datasets

Use the load_dataset function to load data from saved files into pandas DataFrames. This function supports loading from both individual files and directories containing multiple data files.

Contributing

Contributions to the project are welcome. Please follow the standard fork and pull request workflow.

License

This project is open-sourced under the MIT License. See the LICENSE file for more details.

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

querypanda-0.2.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

querypanda-0.2.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file querypanda-0.2.0.tar.gz.

File metadata

  • Download URL: querypanda-0.2.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for querypanda-0.2.0.tar.gz
Algorithm Hash digest
SHA256 16fee6a6528a1ef22bd33d235876d02f81c1dfd835482c63c62689388e72e30f
MD5 03d44a794a32528fdf67dd0720431c7d
BLAKE2b-256 9c42a7910eae76a279f7d0af398b202f210cee830519d1bbe283e1160170e019

See more details on using hashes here.

File details

Details for the file querypanda-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: querypanda-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.0

File hashes

Hashes for querypanda-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ffc8b8ef661b7c967a36041c577fc54b0257ecc120ec5eb480b078dab05afd3
MD5 f159649ad3ccbce969a0e0e286388fbe
BLAKE2b-256 307675b49e15e93396cd5ba5d095b508021e023c93d593b29374ba90dba96c30

See more details on using hashes here.

Supported by

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