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.2.tar.gz (10.6 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.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: querypanda-0.2.2.tar.gz
  • Upload date:
  • Size: 10.6 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.2.tar.gz
Algorithm Hash digest
SHA256 cce2c71defb2d772003573ebd9a4d8ba1d6f10dd370758e232d7ef112e42ef83
MD5 0b9a6a5261a16851234b2c13d47e95ed
BLAKE2b-256 d4880b9983e187725a4e60586c446836b312fb6ca53f1f5c01ccdac5035db3b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: querypanda-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 96ebe754c8a4f63f80fa36482058260616f637728fea5657d58b5ff7ef111580
MD5 02cc836c09212caead92efbb2c55b18d
BLAKE2b-256 1ab6513124bd1bf37638ff6abe59a048c8c50ef5d7196d738f91cc1b8b2ef275

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