sqlalchemy_singlestoredb.ColumnStore

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

SingleStore columnstore table type specification.

Columnstore tables are disk-based tables optimized for analytical workloads (OLAP) with fast scans and aggregations over large datasets. This is the default table type in SingleStore.

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

Note

global_temporary is not supported for columnstore tables.

Examples

Basic columnstore table (default):

>>> ColumnStore()

Temporary columnstore table:

>>> ColumnStore(temporary=True)

Reference columnstore table:

>>> ColumnStore(reference=True)

Table Usage:

from sqlalchemy import Column, DateTime, Integer, MetaData, Numeric, Table
from sqlalchemy_singlestoredb import ColumnStore
metadata = MetaData()
analytics = Table(
    'analytics', metadata,
    Column('id', Integer, primary_key=True),
    Column('user_id', Integer),
    Column('event_time', DateTime),
    Column('amount', Numeric(10, 2)),
    singlestoredb_table_type=ColumnStore(),
)
# Temporary columnstore table
temp_analytics = Table(
    'temp_analytics', metadata,
    Column('id', Integer),
    Column('data', Integer),
    singlestoredb_table_type=ColumnStore(temporary=True),
)
# Reference columnstore table
country_codes = Table(
    'country_codes', metadata,
    Column('code', String(2), primary_key=True),
    Column('name', String(100)),
    singlestoredb_table_type=ColumnStore(reference=True),
)

ORM Usage:

from sqlalchemy import Column, DateTime, Integer, Numeric, String
from sqlalchemy.orm import declarative_base
from sqlalchemy_singlestoredb import ColumnStore
Base = declarative_base()
class Analytics(Base):
    __tablename__ = 'analytics'
    id = Column(Integer, primary_key=True)
    user_id = Column(Integer)
    event_time = Column(DateTime)
    amount = Column(Numeric(10, 2))
    __table_args__ = {
        'singlestoredb_table_type': ColumnStore(),
    }
class CountryCode(Base):
    '''Reference table replicated to all nodes.'''
    __tablename__ = 'country_codes'
    code = Column(String(2), primary_key=True)
    name = Column(String(100))
    __table_args__ = {
        'singlestoredb_table_type': ColumnStore(reference=True),
    }
__init__(reference: bool = False, 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