Skip to main content

DB Library

Project description

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:

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"

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

cafex_db-1.0.0-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file cafex_db-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cafex_db-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.10

File hashes

Hashes for cafex_db-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a16b24719592d0c612bdfd59aa3f869e59f83845ddee23d97bf48f168cf896d0
MD5 f337f36b2861265dc6fc9794fd113622
BLAKE2b-256 be270098d3714ef8756f0eb9103ac2c8c37fde58af44a39a8c0711d4cb18234d

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