Skip to main content

`superduper_sql` is a plugin for SQL databases that allows you to use these databases as databackends for Superduper.

Project description

superduper_sql

superduper-sql is a plugin for SQL databackends that allows you to use these backends with superduper.

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_sql

API

Class Description
superduper_sql.data_backend.SQLDataBackend sql data backend for the database.

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_sql-0.6.1.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

superduper_sql-0.6.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file superduper_sql-0.6.1.tar.gz.

File metadata

  • Download URL: superduper_sql-0.6.1.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for superduper_sql-0.6.1.tar.gz
Algorithm Hash digest
SHA256 e2afaf13d564e7bdda813df94d4bea3b0170b18d2e13eb547c03b91a3d358a1e
MD5 5ceb25171cd9f2680859205b16cb2b6c
BLAKE2b-256 ac551d89cf42dd67454623fba4957c91bb3fe73d517a8a8d606966a9bd945a56

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_sql-0.6.1.tar.gz:

Publisher: release_plugins.yaml on superduper-io/superduper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file superduper_sql-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: superduper_sql-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for superduper_sql-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a68731a2c3616f002beff44ab883ae463bda06948378980e18999f584e1e574
MD5 c950200d053657512bc29752d75df326
BLAKE2b-256 61a2bcbd4df210195b2bc9a7eef2574fc66f9fdfb556cf451ec8ddc805e7d874

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_sql-0.6.1-py3-none-any.whl:

Publisher: release_plugins.yaml on superduper-io/superduper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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