Metadata-Version: 2.4
Name: cafex-db
Version: 1.0.0
Summary: DB Library
Author-email: QA Automation Team <qa_automation@gmail.com>
Project-URL: Homepage, https://example.com
Project-URL: Documentation, https://readthedocs.org
Project-URL: Repository, https://github.com/me/spam.git
Project-URL: Issues, https://github.com/me/spam/issues
Project-URL: Changelog, https://github.com/me/spam/blob/master/CHANGELOG.md
Keywords: db,db testing,pytest,automation
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: cafex-core>=1.0.0
Requires-Dist: thrift==0.16.0
Requires-Dist: PyHive==0.7.0
Requires-Dist: snowflake-connector-python==3.8.1
Requires-Dist: PyMySQL==1.1.1
Requires-Dist: oracledb==3.1.0
Requires-Dist: sqlAlchemy==1.4.29
Requires-Dist: pymssql==2.3.0
Requires-Dist: pysnowflake==0.1.3
Requires-Dist: cassandra-driver==3.29.2
Requires-Dist: pymongo==4.11.2
Requires-Dist: google-cloud-bigquery==3.31.0
Requires-Dist: pymongo==4.11.2
Requires-Dist: psycopg2==2.9.10

# CAFE-DB

CAFE-DB is a Python package that provides tools and utilities for database testing. It is part of the CAFE (Core Automation Framework Enhancements) monorepo.

### Features

CAFE-DB offers the following features:

- **Database connection:** Supports connections to various databases, including MSSQL, MySQL, Oracle, Hive, Postgres, and Cassandra.
- **Query execution:** Provides methods to execute SQL queries and retrieve data.
- **Result set comparison:** Offers methods to compare result sets, allowing for efficient validation of database data.
- **Data-driven testing:** Supports data-driven testing approaches to execute tests with different data sets.
- **Reporting:** Integrates with CAFE's reporting capabilities to generate comprehensive test reports.

### Getting Started

#### **Prerequisites**

- Python 3.12 or later
- pip 24 or later (Python package manager)

#### **Installation**

1. Install CAFE-DB using pip:

   ```
   pip install cafex-db
   ```

### Usage

CAFE-DB provides a set of intuitive methods and classes to facilitate database testing. Here's a basic example:

```python
from cafex_db import database_handler

# Create a database connection
db_handler = database_handler.DatabaseHandler()
connection = db_handler.create_connection(db_type="mssql", server="dbserver", database="testdb")

# Execute a query
result_set = db_handler.execute_query(connection, "SELECT * FROM users")

# Convert the result set to a list
result_list = db_handler.resultset_to_list(result_set)

# Validate the data
assert result_list[0][1] == "John Doe"
