Skip to main content

Basejump indexes a database and connects it with an AI data agent to chat with your data.

Key Features

  • ✅ Accuracy: Uses SQLglot to parse and validate queries, preventing hallucinated tables, columns, or filters
  • 🔒 Security: Role-based access control ensures users and AI agents only access provisioned data
  • ⚡ Fast Indexing: Redis vector database integration for rapid semantic search
  • 🗄️ Full Tracking: Pre-configured schema tracks chat history, clients, teams, users, and query results
  • 💾 Smart Caching: Support semantic caching for retrieval of datasets based on similar questions
  • 📦 Result Storage: Saves data results for later reference and auditing

Installation

Create a virtual environment and then install from PYPI:

pip install basejump-core

Example usage

A complete working example can be found in the basejump repo under basejump-demo/main.py. Here's the core functionality in just 10 lines:

async with service.run_session() as (core_session, db):
    service_context = service.create_service_context(core_session)
    user_info = await service.create_internal_user_info(db, service_context)
    connection = await service.setup_database(db, service_context, user_info, client_conn_params)
    await service.chat(
        db,
        "Provide a report of all clients.",
        service_context,
        user_info,
        connection,
    )

Next steps

Index your own database

Modify the client_conn_params in basejump-demo/settings to your own test database to explore how Basejump AI responds to your data.

Index a database from dbt artifacts

If a dbt project builds the tables, Basejump can describe them with dbt's metadata instead of only what the warehouse reports. dbt describes and the warehouse executes: Basejump still connects to the warehouse, which decides which tables and columns exist and which the connection may read, and runs every query. dbt adds table and column descriptions, foreign keys (from relationships tests and contract constraints), primary keys, notes from not_null, unique and similar tests, and the accepted values of columns, which the agent then checks WHERE clause values against without querying the column. A column's type is the warehouse's; dbt's type is used only when the warehouse reports none. Only dbt's JSON artifacts are read, so dbt itself isn't needed.

from basejump.core.database.crud import crud_dbt
from basejump.core.database.dbt import read_dbt_project

# target/manifest.json, and optionally target/catalog.json from `dbt docs generate` for column types
project = read_dbt_project("target/manifest.json", catalog="target/catalog.json")
# Makes dbt the metadata source of the database (db_id) and stores what the next index needs
await crud_dbt.save_dbt_project(db=db, client_id=client_id, db_id=db_id, project=project)

Indexing the database (index_db) then uses the stored dbt metadata, as does a reindex, so the artifacts are only needed again when the dbt project changes. For a database that is already indexed, crud_dbt.replace_dbt_project stores new artifacts and updates the stored tables without overwriting edits made in Basejump since; reindex afterwards. To inspect tables without storing anything, pass dbt_project=project to TableManager.

For a database whose metadata source is dbt, the agent also gets a tool that reads a table's dbt code (the compiled and the Jinja SQL, file path, materialization and upstream tables). It only answers for tables the connection can query, but the code is shown as dbt has it, so it can name upstream tables and columns the connection can't query. Manifests with schema v12 (dbt 1.8 and later) are supported.

Try Basejump Cloud

If you want to see the basejump open source project in action, you can check out https://basejump.ai/ to see how we implemented it. Docs on using the web interface can be found here: https://docs.basejump.ai/

The Basejump API docs can be found here: https://docs.basejump.ai/api/api-reference

Basejump would not be possible without all of the open source projects it is built on. The following are vital to the success of Basejump 👏

  • Llama Index: For AI data agents
  • SQLAlchemy: For database inspection and connections
  • SQLGlot: SQL query parsing
  • sql-ground: Checks the SQL the AI writes (tables, columns and filter values) before it runs

Supported Databases

The following databases are currently supported. If you don't see one, submit a PR to get yours added:

  • Postgres
  • Snowflake
  • Athena
  • MySQL
  • Redshift
  • SQL Server

Supported AI Models

Basejump is built on Llama Index and can theoretically support any AI models Llama Index supports. Adding support for a new model is relatively straightforward, so please request one if you don't see it.

Most of the LLMS from OpenAI and Anthropic are available via Azure and AWS respectively. Supported Claude models can be found here. Supported OpenAI models can be found here.

To add a new model to Basejump, just update the AIModelSchema in basejump.core.models.schemas and submit a PR.

Metadata

Release files for basejump-core 0.36.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for basejump-core 0.36.1
File Size Uploaded Provenance Actions
basejump_core-0.36.1.tar.gz 181.4 kB Without provenance Details for basejump_core-0.36.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for basejump-core 0.36.1
File Interpreter ABI Platform Actions
basejump_core-0.36.1-py3-none-any.whl Python 3 none any Details for basejump_core-0.36.1-py3-none-any.whl

Total release size: 415.8 kB

Release files / basejump_core-0.36.1.tar.gz

Download URL basejump_core-0.36.1.tar.gz
Size 181.4 kB
Tags Source
SHA-256 checksum
How to use checksums
42971bbe09ebed4012c5bec4dd6b4d85222001296d5b9621b22419c570d3ffc8
BLAKE2b-256 checksum
How to use checksums
760bc68ed16781529f39a213576be25d5b9e600761181e7b2b65f8459a22c01a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.3

Release files / basejump_core-0.36.1-py3-none-any.whl

Download URL basejump_core-0.36.1-py3-none-any.whl
Size 234.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fe61fe22e9fc6e6e2c045cb1e1bd1ec74f5ab0326ddf88a7d3f9e038f487c72
BLAKE2b-256 checksum
How to use checksums
3b9942784b9de3fb175050fa335c9953d4e7a32bb43545885440f6fe53f41885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.3

Security for basejump-core 0.36.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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