Path: blob/main/singlestoredb/__init__.py
469 views
#!/usr/bin/env python1"""2SingleStoreDB module.34Examples5--------6>>> import singlestoredb as s27>>> conn = s2.connect('user:password@host/dbname')8>>> cur = conn.cursor()9>>> cur.execute('select * from customers')10>>> for row in cur:11... print(row)1213"""1415__version__ = '1.15.4'1617from typing import Any1819from .config import options, get_option, set_option, describe_option20from .connection import connect, apilevel, threadsafety, paramstyle21from .exceptions import (22Warning, Error, InterfaceError, DatabaseError, OperationalError,23IntegrityError, InternalError, ProgrammingError, NotSupportedError,24DataError, ManagementError,25)26from .management import (27manage_cluster, manage_workspaces, manage_files, manage_regions,28)29from .types import (30Date, Time, Timestamp, DateFromTicks, TimeFromTicks, TimestampFromTicks,31Binary, STRING, BINARY, NUMBER, DATETIME, ROWID,32)33# These are only loaded if the singlestore-vectorstore package is available34try:35from .vectorstore import (36vector_db, IndexInterface, IndexList, IndexModel, MatchTypedDict,37Metric, IndexStatsTypedDict, NamespaceStatsTypedDict, Vector,38VectorDictMetadataValue, VectorMetadataTypedDict, VectorTuple,39VectorTupleWithMetadata, DeletionProtection, AndFilter, EqFilter,40ExactMatchFilter, FilterTypedDict, GteFilter, GtFilter, InFilter,41LteFilter, LtFilter, NeFilter, NinFilter, OrFilter, SimpleFilter,42)43except (ImportError, ModuleNotFoundError):44pass454647#48# This function is defined here to prevent the side-effect of49# attempting to load the SQLAlchemy dialect in the core SDK.50#51def create_engine(*args: Any, **kwargs: Any) -> Any:52"""53Create an SQLAlchemy engine for SingleStoreDB.5455Parameters56----------57**kwargs : Any58The parameters taken here are the same as for59`sqlalchemy.create_engine`. However, this function can be60called without any parameters in order to inherit parameters61set by environment variables or parameters set in by62options in Python code.6364See Also65--------66`sqlalchemy.create_engine`6768Returns69-------70SQLAlchemy engine7172"""73from .alchemy import create_engine74return create_engine(*args, **kwargs)757677