Skip to main content

Litestar Logo - Light Litestar Logo - Dark

Project Status
CI/CD Latest Release ci Documentation Building
Quality Coverage Quality Gate Status Maintainability Rating Reliability Rating Security Rating
Package PyPI - Version PyPI - Support Python Versions Litestar OracleDB PyPI - Downloads
Community Reddit Discord Matrix Medium Twitter Blog
Meta Litestar Project types - Mypy License - MIT Litestar Sponsors linting - Ruff code style - Ruff
# Litestar - Oracle Database Plugin

A barebones Oracle Database plugin for Litestar. This plugin is useful for when you plan to use no ORM or need to manage the Oracle connection separately.

Usage

Installation

pip install litestar-oracledb

Example

Here is a basic application that demonstrates how to use the plugin.

from __future__ import annotations

from typing import TYPE_CHECKING

from litestar import Controller, Litestar, Request, get

from litestar_oracledb import AsyncDatabaseConfig, AsyncPoolConfig, OracleDatabasePlugin

if TYPE_CHECKING:
    from oracledb import AsyncConnection


class SampleController(Controller):
    @get(path="/")
    async def sample_route(self, request: Request, db_connection: AsyncConnection) -> dict[str, str]:
        """Check database available and returns app config info."""
        with db_connection.cursor() as cursor:
            await cursor.execute("select 'a database value' a_column from dual")
            result = await cursor.fetchone()
            request.logger.info(result[0])
            if result:
                return {"a_column": result[0]}
        return {"a_column": "dunno"}


oracledb = OracleDatabasePlugin(
    config=AsyncDatabaseConfig(
        pool_config=AsyncPoolConfig(user="system", password="super-secret", dsn="localhost:1513/FREEPDB1")  # noqa: S106
    )
)
app = Litestar(plugins=[oracledb], route_handlers=[SampleController])

Download files

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

Source Distribution

litestar_oracledb-0.1.2.tar.gz (69.5 kB view details)

Uploaded Source

Built Distribution

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

litestar_oracledb-0.1.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file litestar_oracledb-0.1.2.tar.gz.

File metadata

  • Download URL: litestar_oracledb-0.1.2.tar.gz
  • Upload date:
  • Size: 69.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for litestar_oracledb-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b650077a6638d7676d73ce5af027393a7f55c5b02e22e943f087f2ea90ab3d99
MD5 3e0eaa78591611f4618b2260c29cdd14
BLAKE2b-256 80951e399aa1d7f43c024f218d4e8714257533f902974db2d0ffa7bbaeb3ffd7

See more details on using hashes here.

File details

Details for the file litestar_oracledb-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for litestar_oracledb-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2886d30be0cf3f174b82fbcbe04e5bdcfed5c574d3ba09212e3cbe854d0771d2
MD5 8653c5037dc92c2493d87853eae15191
BLAKE2b-256 04574a2e9ec4c81108c385906ac104eb529b5468f1ab74384e74d52c125850d5

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 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