Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ reports*/

venv/
.venv310/
.venv311/
.venv/
.vscode/
.python-version
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ All notable changes to this project will be documented in this file.
The format is based on the `Keep a Changelog <https://keepachangelog.com/en/1.1.0/>`__,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`__.

1.0.7 - 2026-11-27
------------------

Added
~~~~~

- Added ``VECDB_DEBUG`` to control SDK logging. Set it before importing
``oracle_vecdb``; use levels such as ``INFO``, ``DEBUG``, ``TRACE``, or ``OFF``.
- Added README links to the Autonomous AI Vector Database documentation,
setup guide, and PL/SQL package reference.

Changed
~~~~~~~

- Use
``VECDB_DEBUG`` to enable logging and Python logging handlers to choose
the output destination and format.

Fixed
~~~~~

- Prevented automatic retries from repeating write operations when a
connection or TLS failure leaves the request outcome uncertain.

1.0.6 - 2026-10-16
------------------

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ Learn Oracle VecDB hands-on. The Oracle AI Developer Hub includes runnable noteb
- **[Hands-on Notebooks](https://github.com/oracle-devrel/oracle-ai-developer-hub/tree/main/notebooks/vecdb)**
- **[GitHub Releases](https://github.com/oracle/vecdb-python-sdk/releases)**
- **[Locally-managed REST](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/26.2/)**
- **[Autonomous AI Vector Database Documentation](https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/)**
- **[Get Started Using Autonomous AI Vector Database](https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/vecdb/get-started-using-autonomous-ai-vector-database.html)**
- **[PL/SQL DBMS_VECTOR_DATABASE Package](https://docs.oracle.com/en/database/oracle/oracle-database/26/arpls/dbms_vector_database1.html)**

---

Expand Down
78 changes: 78 additions & 0 deletions docs/sdk-logging-design-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# SDK logging

Configure SDK logging with `VECDB_DEBUG`. Set it before the first import of
`oracle_vecdb`; the SDK reads it once when the package loads.

Set the value in the shell:

```bash
VECDB_DEBUG=INFO python your_app.py
```

Or set it in Python before importing the SDK:

```python
import os

os.environ.setdefault("VECDB_DEBUG", "INFO")

import oracle_vecdb
```

`setdefault` keeps a value supplied by the shell. Replace it with a direct
assignment when the script should always choose its own level.

## Levels

Values are case-insensitive, and surrounding whitespace is ignored.

| `VECDB_DEBUG` value | Output |
| --- | --- |
| Unset or empty | No SDK console output by default. Application-configured Python logging can still receive SDK records. |
| `INFO` | Successful operation summaries and errors. |
| `DEBUG`, `1`, `true`, `yes`, `on` | INFO output plus retry decisions. |
| `TRACE` | DEBUG output plus operation starts, batch details, and HTTP and deserialization timings. |
| `WARNING`, `WARN`, `ERROR` | Failed operation summaries. These summaries are emitted at ERROR. |
| `CRITICAL`, `FATAL` | Critical threshold; the SDK currently emits no critical events. |
| `OFF`, `0`, `false`, `no` | Suppress SDK logging, including records from child loggers. |
| `NOTSET` | Use the effective level from the parent logger. |

An unsupported value raises `ValueError` during package import. There is no
numeric verbosity scale. `TRACE` is a detail mode at the DEBUG threshold.
Changing the environment after import does not reconfigure the SDK. Choose
`TRACE` before import to receive phase timings.

## Python logging

The SDK uses the `oracle_vecdb` logger and its `operations`, `ords`, `auth`, and
`performance` child loggers. When `VECDB_DEBUG` is unset, the SDK adds no console
handler. When enabled, it supplies a stderr fallback so the environment
variable works on its own. An application handler on the emitting logger, the
package logger, or a reachable parent takes precedence over that fallback.

Use standard Python logging to choose destinations, formats, and runtime
thresholds. For example, attach a `FileHandler` or `RotatingFileHandler` to
`logging.getLogger("oracle_vecdb")`. The SDK does not configure the root logger,
change dependency logger levels, or enable HTTP wire debugging. `OFF` is a
package-wide stop and cannot be overridden by lowering a child logger's level.

## Events and privacy

Each public SDK operation emits one INFO success summary or ERROR failure
summary. DEBUG includes retry decisions; TRACE adds operation starts, batch
details, and phase timings. Nested operations carry correlation IDs, and
excess detail is capped while completion summaries remain available.

Structured fields are available on each Python `LogRecord` as `record.vecdb`.
They include the event and operation names, correlation IDs, outcome, timing,
counts, HTTP status, and normalized error codes when known. The SDK excludes
request and response payloads, vectors, metadata, SQL, credentials, headers,
URLs, resource names, and free-form exception text. Logging failures do not
change SDK results or exceptions.

## Configuration behavior

Logging is controlled independently of `Configuration` and OAuth arguments;
there are no per-client logging options. Set `VECDB_DEBUG` before importing the
package. A request's `debug_flags` parameter is for server-side VecDB behavior
and does not control SDK logging.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dev = [
test = [
"pytest", # Testing framework
"pytest-cov", # Test coverage tool
"coverage==7.16.2", # Avoid SQLite read-only failures seen with 7.17.1 in CI
"pytest-mock", # Mocker
"pytest-xdist", # Parallel test execution
"lxml", # Generate XML report
Expand All @@ -60,9 +61,11 @@ doc = [
[project.urls]
Repository = "https://github.com/oracle/vecdb-python-sdk"
Homepage = "https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/vcapi/overview.html"
"Autonomous AI Vector Database" = "https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/"
"PL/SQL DBMS_VECTOR_DATABASE" = "https://docs.oracle.com/en/database/oracle/oracle-database/26/arpls/dbms_vector_database1.html"

[build-system]
requires = ["setuptools>=65", "wheel"]
requires = ["setuptools>=77.0.3", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
Expand Down
4 changes: 4 additions & 0 deletions src/oracle_vecdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@
from .vecdb_errors import InvalidHostFormatError # noqa: F401
from .vecdb_errors import OAuthTokenError # noqa: F401
from .vecdb_exception import VecDBException # noqa: F401

from ._logging import _configure_logging

_configure_logging()
Loading