Skip to main content

MonkDB Python Client to interact with MonkDB's database engine

Project description

MonkDB

MonkDB Python Client Driver

Python Stable Version Last Updated

Introduction

This package is a MonkDB's Python SDK client library. It is compliant with PEP0249 to interact with database engines using Python's established goto practices.


Installation

One can use the regular pip to install monkdb client driver. It installs the latest package.

pip install monkdb

Or if you want to install a specific version using pip, please run the below command.

pip install monkdb==1.0.5

One can also use other python package managers. For example, below is the command to install with poetry. It installs the latest package

poetry add monkdb

Or if you want to add specific version of MonkDB using poetry, please run the below command.

poetry add monkdb@1.0.0

Usage Instructions

Connect to MonkDB

The first step in working with MonkDB is to establish a connection using the client instance. This is a prerequisite for performing downstream operations such as executing SQL statements, interacting with tables, and more.

from monkdb import client

try:
    connection = client.connect(
        f"http://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}", username=DB_USER
    )
    cursor = connection.cursor()
    print("✅ Database connection established successfully!")
except Exception as e:
    print(f"⚠️ Error connecting to the database: {e}")
    exit(1)

Sample Downstream Usage

Use the cursor that is connected to MonkDB in the previous step to execute SQL statements, close the connection, and perform other database operations.

In the example below, we are dropping the table if it exists:

# Drop table if exists
cursor.execute(f"DROP TABLE IF EXISTS {DB_SCHEMA}.{TABLE_NAME}")
print(f"Dropped {DB_SCHEMA}.{TABLE_NAME} table")

Closing the connection

If the connection is not needed anymore, please close the connection to MonkDB.

# Close connection
cursor.close()
connection.close()

Support

For enterprise support, please write to us at devs@monkdb.com.

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.

monkdb-1.0.5-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

Details for the file monkdb-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: monkdb-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 36.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/24.3.0

File hashes

Hashes for monkdb-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f6b5ac7a2120d6b45d3b1ee3ca0bc29c8b9233b5892d28060d477daba2072abb
MD5 0291080a5056a15d5e9e80a7e2a9f3a7
BLAKE2b-256 ede4e32bba5d84b91b21fd1803fd21caefa71b9c6f64e6fa83e1276d339f0b20

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