Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 2.54 KB

File metadata and controls

69 lines (50 loc) · 2.54 KB

title: sqlalchemy.orm.attributes QueryableAttribute Example Code category: page slug: sqlalchemy-orm-attributes-queryableattribute-examples sortorder: 500031077 toc: False sidebartitle: sqlalchemy.orm.attributes QueryableAttribute meta: Example code for understanding how to use the QueryableAttribute class from the sqlalchemy.orm.attributes module of the SQLAlchemy project.

QueryableAttribute is a class within the sqlalchemy.orm.attributes module of the SQLAlchemy project.

InstrumentedAttribute and flag_modified are a couple of other callables within the sqlalchemy.orm.attributes package that also have code examples.

Example 1 from SQLAthanor

SQLAthanor (PyPI package information and project documentation) is a SQLAlchemy extension that provides serialization and deserialization support for JSON, CSV, YAML and Python dictionaries. This project is similar to Marshmallow with one major difference: SQLAthanor works through SQLAlchemy models while Marshmallow is less coupled to SQLAlchemy because it requires separate representations of the serialization objects. Both libraries have their uses depending on whether the project plans to use SQLAlchemy for object representations or would prefer to avoid that couping. SQLAthanor is open sourced under the MIT license.

SQLAthanor / sqlathanor / attributes.py

# attributes.py


~~from sqlalchemy.orm.attributes import QueryableAttribute as SA_QueryableAttribute
from sqlalchemy import util

from validator_collection import validators, checkers

from sqlathanor._serialization_support import SerializationMixin
from sqlathanor.utilities import bool_to_tuple, callable_to_dict


BLANK_ON_SERIALIZE = {
    'csv': None,
    'json': None,
    'yaml': None,
    'dict': None
}


class AttributeConfiguration(SerializationMixin):

    def __init__(self,
                 *args,
                 **kwargs):
        object.__setattr__(self, '_dict_proxy', {})
        self._current = -1
        self._name = None


## ... source file continues with no further QueryableAttribute examples...