sqlalchemy_singlestoredb.RowStore

class sqlalchemy_singlestoredb.RowStore(reference: bool = False, temporary: bool = False, global_temporary: bool = False)

SingleStore rowstore table type specification.

Rowstore tables are in-memory tables optimized for transactional workloads (OLTP). They provide fast point lookups, inserts, and updates.

Parameters:
  • reference (bool, default False) – Create a reference table that is replicated across all nodes

  • temporary (bool, default False) – Create a temporary table that exists only during the client session

  • global_temporary (bool, default False) – Create a global temporary table that persists beyond client sessions

Examples

Basic rowstore table:

>>> RowStore()

Temporary rowstore table:

>>> RowStore(temporary=True)

Global temporary rowstore table:

>>> RowStore(global_temporary=True)

Reference rowstore table:

>>> RowStore(reference=True)

Table Usage:

from sqlalchemy import Column, Integer, MetaData, String, Table
from sqlalchemy_singlestoredb import RowStore
metadata = MetaData()
cache = Table(
    'cache', metadata,
    Column('key', String(255), primary_key=True),
    Column('value', String(1000)),
    singlestoredb_table_type=RowStore(),
)
# Temporary rowstore table
temp_data = Table(
    'temp_data', metadata,
    Column('id', Integer, primary_key=True),
    Column('data', String(255)),
    singlestoredb_table_type=RowStore(temporary=True),
)
# Reference rowstore table
lookups = Table(
    'lookups', metadata,
    Column('code', String(10), primary_key=True),
    Column('description', String(200)),
    singlestoredb_table_type=RowStore(reference=True),
)

ORM Usage:

from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import declarative_base
from sqlalchemy_singlestoredb import RowStore
Base = declarative_base()
class Cache(Base):
    __tablename__ = 'cache'
    key = Column(String(255), primary_key=True)
    value = Column(String(1000))
    __table_args__ = {
        'singlestoredb_table_type': RowStore(),
    }
class Lookup(Base):
    '''Reference rowstore table replicated to all nodes.'''
    __tablename__ = 'lookups'
    code = Column(String(10), primary_key=True)
    description = Column(String(200))
    __table_args__ = {
        'singlestoredb_table_type': RowStore(reference=True),
    }
__init__(reference: bool = False, temporary: bool = False, global_temporary: bool = False) None

Methods

__init__([reference, temporary, ...])

against(target)

Return a copy of this _schema.ExecutableDDLElement which will include the given target.

compare(other, **kw)

Compare this _expression.ClauseElement to the given _expression.ClauseElement.

compile([bind, dialect])

Compile this SQL expression.

execute_if([dialect, callable_, state])

Return a callable that will execute this _ddl.ExecutableDDLElement conditionally within an event handler.

execution_options(**kw)

Set non-SQL options for the statement which take effect during execution.

get_children(*[, omit_attrs])

Return immediate child visitors.HasTraverseInternals elements of this visitors.HasTraverseInternals.

get_execution_options()

Get the non-SQL options which will take effect during execution.

memoized_instancemethod(fn)

Decorate a method memoize its return value.

options(*options)

Apply options to this statement.

params([_ClauseElement__optionaldict])

Return a copy with _expression.bindparam() elements replaced.

self_group([against])

Apply a 'grouping' to this _expression.ClauseElement.

unique_params([_ClauseElement__optionaldict])

Return a copy with _expression.bindparam() elements replaced.

Attributes

allows_lambda

description

entity_namespace

inherit_cache

Indicate if this HasCacheKey instance should make use of the cache key generation scheme used by its immediate superclass.

is_clause_element

is_delete

is_dml

is_from_statement

is_insert

is_select

is_selectable

is_text

is_update

stringify_dialect

supports_execution

target

uses_inspection

negation_clause

proxy_set