Skip to main content

Superduper ibis is a plugin for ibis-framework that allows you to use Superduper as a backend for your ibis queries.

Project description

superduper_ibis

Superduper ibis is a plugin for ibis-framework that allows you to use Superduper as a backend for your ibis queries.

This plugin cannot be used independently; it must be used together with superduper_ibis.

Superduper supports SQL databases via the ibis project. With superduper, queries may be built which conform to the ibis API, with additional support for complex data-types and vector-searches.

Installation

pip install superduper_ibis

API

Class Description
superduper_ibis.data_backend.IbisDataBackend Ibis data backend for the database.
superduper_ibis.query.IbisQuery A query that can be executed on an Ibis database.
superduper_ibis.db_helper.DBHelper Generic helper class for database.
superduper_ibis.db_helper.ClickHouseHelper Helper class for ClickHouse database.
superduper_ibis.field_types.FieldType Field type to represent the type of a field in a table.

Connection examples

MySQL

from superduper import superduper

db = superduper('mysql://<mysql-uri>')

Postgres

from superduper import superduper

db = superduper('postgres://<postgres-uri>')

Other databases

from superduper import superduper

db = superduper('<database-uri>')

Query examples

Inserting data

Table data must correspond to the Schema for that table. Either create a Schema and Table or use an auto-detected Schema. Once you've got a Schema, all data inserted must conform to that Schema:

import pandas

pandas.DataFrame([
    PIL.Image.open('image.jpg'), 'some text', 4,
    PIL.Image.open('other_image.jpg'), 'some other text', 3,
])

t.insert(dataframe.to_dict(orient='records'))

Selecting data

superduper supports selecting data via the ibis query API. For example:

db['my_table'].filter(t.rating > 3).limit(5).select(t.image).execute()

Vector-search

Vector-searches are supported via the like operator:

(
    db['my_table']
    .like({'text': 'something like this'}, vector_index='my-index')
    .filter(t.rating > 3)
    .limit(5)
    .select(t.image, t.id)
).execute()

Vector-searches are either first or last in a chain of operations:

(
    db['my_table']
    t.filter(t.rating > 3)
    .limit(5)
    .select(t.image, t.id)
    .like({'text': 'something like this'}, vector_index='my-index')
).execute()

Updating data

Updates are not covered for superduper SQL integrations.

Deleting data

db.databackend.drop_table('my-table')

Project details


Download files

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

Source Distribution

superduper_ibis-0.4.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

superduper_ibis-0.4.0-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file superduper_ibis-0.4.0.tar.gz.

File metadata

  • Download URL: superduper_ibis-0.4.0.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for superduper_ibis-0.4.0.tar.gz
Algorithm Hash digest
SHA256 32aa3ea6bc9d2125b86564fa5da639fc8d7e29e5fda73120a738cc6976a57add
MD5 dfcece4eedbd52b5b12d32aedac392c7
BLAKE2b-256 0a39010979fcdbc619c283c36f60b2cc77a7d0d1fd036d4df3ef1620920d119c

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_ibis-0.4.0.tar.gz:

Publisher: release_plugins.yaml on superduper-io/superduper

Attestations:

File details

Details for the file superduper_ibis-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for superduper_ibis-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb9acfb9e6e4dff795a2e1e4b5d6f397ebcf106ec4bdfa067b8bd658ebd096dd
MD5 1110d1ca574a1d6dac2927439e006a29
BLAKE2b-256 aa3ec33d9c74674bc93e6dabc4effe71f2a367b0be8a8b640e8daa9c6679ef80

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_ibis-0.4.0-py3-none-any.whl:

Publisher: release_plugins.yaml on superduper-io/superduper

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page