## panko.storage.sqlalchemy package

updated: 2020-10-17 18:35

# panko.storage.sqlalchemy package

## Submodules

## panko.storage.sqlalchemy.models module

SQLAlchemy models for Panko data.

class `panko.storage.sqlalchemy.models.``Event`(message_id, event_type, generated, raw)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  `event_type`
  `event_type_id`
  `generated`
  `id`
  `message_id`
  `raw`

class `panko.storage.sqlalchemy.models.``EventType`(event_type)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Types of event records.

  `desc`
  `id`

class `panko.storage.sqlalchemy.models.``JSONEncodedDict`(*args, **kwargs)

  Bases: `sqlalchemy.sql.type_api.TypeDecorator`

  Represents an immutable structure as a json-encoded string.

  `impl`

    alias of `sqlalchemy.sql.sqltypes.Text`

  static `process_bind_param`(value, dialect)

    Receive a bound parameter value to be converted.

    Subclasses override this method to return the value that should be passed along to the underlying `TypeEngine` object, and from there to the DBAPI `execute()` method.

    The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

    This operation should be designed with the reverse operation in mind, which would be the process_result_value method of this class.

    Parameters

      - value – Data to operate upon, of any type expected by this method in the subclass. Can be `None`.

      - dialect – the `Dialect` in use.

  static `process_result_value`(value, dialect)

    Receive a result-row column value to be converted.

    Subclasses should implement this method to operate on data fetched from the database.

    Subclasses override this method to return the value that should be passed back to the application, given a value that is already processed by the underlying `TypeEngine` object, originally from the DBAPI cursor method `fetchone()` or similar.

    The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

    Parameters

      - value – Data to operate upon, of any type expected by this method in the subclass. Can be `None`.

      - dialect – the `Dialect` in use.

    This operation should be designed to be reversible by the “process_bind_param” method of this class.

class `panko.storage.sqlalchemy.models.``PankoBase`

  Bases: `object`

  Base class for Panko Models.

  `update`(values)

    Make the model object behave like a dict.

class `panko.storage.sqlalchemy.models.``PreciseTimestamp`(*args, **kwargs)

  Bases: `sqlalchemy.sql.type_api.TypeDecorator`

  Represents a timestamp precise to the microsecond.

  `impl`

    alias of `sqlalchemy.sql.sqltypes.DateTime`

  `load_dialect_impl`(dialect)

    Return a `TypeEngine` object corresponding to a dialect.

    This is an end-user override hook that can be used to provide differing types depending on the given dialect. It is used by the `TypeDecorator` implementation of `type_engine()` to help determine what type should ultimately be returned for a given `TypeDecorator`.

    By default returns `self.impl`.

  static `process_bind_param`(value, dialect)

    Receive a bound parameter value to be converted.

    Subclasses override this method to return the value that should be passed along to the underlying `TypeEngine` object, and from there to the DBAPI `execute()` method.

    The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

    This operation should be designed with the reverse operation in mind, which would be the process_result_value method of this class.

    Parameters

      - value – Data to operate upon, of any type expected by this method in the subclass. Can be `None`.

      - dialect – the `Dialect` in use.

  static `process_result_value`(value, dialect)

    Receive a result-row column value to be converted.

    Subclasses should implement this method to operate on data fetched from the database.

    Subclasses override this method to return the value that should be passed back to the application, given a value that is already processed by the underlying `TypeEngine` object, originally from the DBAPI cursor method `fetchone()` or similar.

    The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

    Parameters

      - value – Data to operate upon, of any type expected by this method in the subclass. Can be `None`.

      - dialect – the `Dialect` in use.

    This operation should be designed to be reversible by the “process_bind_param” method of this class.

class `panko.storage.sqlalchemy.models.``TraitDatetime`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Event datetime traits.

  `event_id`
  `key`
  `value`

class `panko.storage.sqlalchemy.models.``TraitFloat`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Event float traits.

  `event_id`
  `key`
  `value`

class `panko.storage.sqlalchemy.models.``TraitInt`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Event integer traits.

  `event_id`
  `key`
  `value`

class `panko.storage.sqlalchemy.models.``TraitText`(**kwargs)

  Bases: `sqlalchemy.ext.declarative.api.Base`

  Event text traits.

  `event_id`
  `key`
  `value`

## Module contents

updated: 2020-10-17 18:35

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

questions?