Skip to content

Oracle

Installation

pip install "toolfront[oracle]"

Connection URL

Connect to Oracle by passing a connection URL to the Database constructor:

1
2
3
4
5
from toolfront import Database

db = Database(url="oracle://{user}:{password}@{host}:{port}/{database}")

revenue = db.ask("What's our total revenue this month?")

Connection Parameters

Alternatively, connect using the Database.from_oracle() method with parameters:

from toolfront import Database

db = Database.from_oracle(
    user="user",
    password="pass",
    host="localhost",
    port=1521,
    database="sales"
)

revenue = db.ask("What's our total revenue this month?")
PARAMETER DESCRIPTION
user

Username.

TYPE: str

password

Password.

TYPE: str

host

Hostname. Default is 'localhost'.

TYPE: str DEFAULT: 'localhost'

port

Port. Default is 1521.

TYPE: int DEFAULT: 1521

database

Used as an Oracle service name if provided.

TYPE: str DEFAULT: None

sid

Unique name of an Oracle Instance, used to construct a DSN if provided.

TYPE: str DEFAULT: None

service_name

Oracle service name, used to construct a DSN if provided. Only one of database and service_name should be provided.

TYPE: str DEFAULT: None

dsn

An Oracle Data Source Name. If provided, overrides all other connection arguments except username and password.

TYPE: str DEFAULT: None

match_schema

Regex pattern to filter schemas. Mutually exclusive with match_tables.

TYPE: str DEFAULT: None

match_tables

Regex pattern to filter tables. Mutually exclusive with match_schema.

TYPE: str DEFAULT: None

**kwargs

Additional arguments passed to the DBAPI connection call.

TYPE: Any DEFAULT: {}