Skip to main content

rdsclient

is a Python package designed to simplify the interaction with AWS RDS instances using the package. It allows executing SQL queries and fetching the results as Pandas or Spark DataFrames.

Features

  • Singleton RDS connection: Ensures a single connection to the RDS instance.
  • Query execution: Execute SELECT, INSERT, UPDATE, DELETE queries on your RDS database.
  • Return data as Pandas DataFrame: Fetch query results directly as Pandas DataFrames for easy data manipulation.
  • Spark DataFrame support: Optionally convert query results to Spark DataFrames for distributed computing.
  • Context-managed MySQL connection: Automatically manage the connection lifecycle with Python's .

Installation

You can install directly from PyPI:

pip install rdsclient

Prerequisites

  • Python 3.7+
  • Dependencies:

These dependencies are automatically installed when you install .

Usage

Simple Query Example

from rdsclient import query_rds

# Define your RDS connection details
host = 'your-rds-host'
user = 'your-username'
password = 'your-password'
database = 'your-database'

# Execute the query and get the result as a Pandas DataFrame
df = query_rds(
    query='SELECT * FROM your_table',
    host=host,
    user=user,
    password=password,
    database=database
)

# Display the result
print(df.head())

Using the RDS Class Directly

from rdsclient import RDS

# Create an RDS instance
rds = RDS(
    host='your-rds-host',
    user='your-username',
    password='your-password',
    database='your-database'
)

# Execute a query and fetch results as a Pandas DataFrame
df = rds.execute_query('SELECT * FROM your_table')

# Optionally, get the results as a Spark DataFrame
spark_df = rds.query_to_spark_df('SELECT * FROM your_table')

# Display the Pandas DataFrame
print(df.head())

Executing Non-Select Queries

You can also execute non-SELECT queries (such as INSERT, UPDATE, DELETE):

# Example for executing an UPDATE query
affected_rows = rds.execute_update('UPDATE your_table SET column_name = %s WHERE condition = %s', ('new_value', 'condition_value'))

print(f'{affected_rows} rows affected.')

Contributing

Contributions are welcome! If you find a bug or have a feature request, please feel free to open an issue or submit a pull request.

Steps for Contributing:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature-name).
  3. Commit your changes (git commit -am 'Add feature').
  4. Push to the branch (git push origin feature-name).
  5. Create a new pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release files for rdsclient 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rdsclient 0.1.0
File Size Uploaded
rdsclient-0.1.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rdsclient 0.1.0
File Interpreter ABI Platform
rdsclient-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / rdsclient-0.1.0.tar.gz

Download URL rdsclient-0.1.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
793e0c2155deae8f4da9922634b8705ea53fef9b5677cead84cd4773e23afc35
BLAKE2b-256 checksum
How to use checksums
b2a7f5ce3f60607786e02c35f58dd49ec99b00bab5d99f5b1e71f8a8dabc8731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / rdsclient-0.1.0-py3-none-any.whl

Download URL rdsclient-0.1.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9cf896e5fea980d3c5350cf4f6f8697191881beb771d2ba834a73c02a406350
BLAKE2b-256 checksum
How to use checksums
00eb13e102c7824260e8b35dbd3ee18867cc5e936f36fa17e459b20ed043fdd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page