Known subclasses: sqlalchemy.dialects.postgresql.asyncpg.AsyncpgJSONB
, sqlalchemy.dialects.postgresql.pg8000._PGJSONB
, sqlalchemy.dialects.postgresql.psycopg._PGJSONB
, sqlalchemy.dialects.postgresql.psycopg2._PGJSONB
Represent the PostgreSQL JSONB type. The :class:`_postgresql.JSONB` type stores arbitrary JSONB format data, e.g.:: data_table = Table('data_table', metadata, Column('id', Integer, primary_key=True), Column('data', JSONB) ) with engine.connect() as conn: conn.execute( data_table.insert(), data = {"key1": "value1", "key2": "value2"} ) The :class:`_postgresql.JSONB` type includes all operations provided by :class:`_types.JSON`, including the same behaviors for indexing operations. It also adds additional operators specific to JSONB, including :meth:`.JSONB.Comparator.has_key`, :meth:`.JSONB.Comparator.has_all`, :meth:`.JSONB.Comparator.has_any`, :meth:`.JSONB.Comparator.contains`, :meth:`.JSONB.Comparator.contained_by`, :meth:`.JSONB.Comparator.delete_path`, :meth:`.JSONB.Comparator.path_exists` and :meth:`.JSONB.Comparator.path_match`. Like the :class:`_types.JSON` type, the :class:`_postgresql.JSONB` type does not detect in-place changes when used with the ORM, unless the :mod:`sqlalchemy.ext.mutable` extension is used. Custom serializers and deserializers are shared with the :class:`_types.JSON` class, using the ``json_serializer`` and ``json_deserializer`` keyword arguments. These must be specified at the dialect level using :func:`_sa.create_engine`. When using psycopg2, the serializers are associated with the jsonb type using ``psycopg2.extras.register_default_jsonb`` on a per-connection basis, in the same way that ``psycopg2.extras.register_default_json`` is used to register these handlers with the json type. .. versionadded:: 0.9.7 .. seealso:: :class:`_types.JSON`
Class |
|
Define comparison operations for :class:`_types.JSON`. |
Class Variable | __visit |
Undocumented |
Inherited from JSON
:
Method | __init__ |
Construct a :class:`_types.JSON` type. |
Instance Variable | astext |
Undocumented |
Inherited from JSON
(via JSON
):
Class |
|
Common function for index / path elements in a JSON expression. |
Class |
|
Placeholder for the datatype of a JSON index value. |
Class |
|
Placeholder for the datatype of a JSON index value. |
Class |
|
Placeholder type for JSON path operations. |
Class |
|
Placeholder for the datatype of a JSON index value. |
Method | bind |
Return a conversion function for processing bind values. |
Method | result |
Return a conversion function for processing result row values. |
Method | should |
Undocumented |
Constant | NULL |
Describe the json value of NULL. |
Class Variable | hashable |
Flag, if False, means values from this type aren't hashable. |
Instance Variable | none |
Undocumented |
Property | python |
Return the Python type object expected to be returned by instances of this type, if known. |
Property | should |
Alias of :attr:`_types.JSON.none_as_null` |
Method | _make |
Undocumented |
Property | _str |
Undocumented |
Inherited from TypeEngineMixin
(via JSON
, JSON
, Indexable
):
Method | adapt |
Undocumented |
Method | dialect |
Undocumented |
Class Variable | __slots__ |
Undocumented |
Property | _static |
Undocumented |
Inherited from TypeEngine
(via JSON
, JSON
, Indexable
, TypeEngineMixin
):
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | as |
Return an instance of the generic type corresponding to this type using heuristic rule. The method may be overridden if this heuristic rule is not sufficient. |
Method | bind |
Given a bind value (i.e. a :class:`.BindParameter` instance), return a SQL expression in its place. |
Method | coerce |
Suggest a type for a 'coerced' Python value in an expression. |
Method | column |
Given a SELECT column expression, return a wrapping SQL expression. |
Method | compare |
Compare this type against the given backend type. |
Method | compare |
Compare two values for equality. |
Method | compile |
Produce a string-compiled form of this :class:`.TypeEngine`. |
Method | copy |
Undocumented |
Method | copy |
Undocumented |
Method | evaluates |
Return a copy of this type which has the :attr:`.should_evaluate_none` flag set to True. |
Method | get |
Return the corresponding type object from the underlying DB-API, if any. |
Method | literal |
Return a conversion function for processing literal values that are to be rendered directly without using binds. |
Method | with |
Produce a copy of this type object that will utilize the given type when applied to the dialect of the given name. |
Class Variable | render |
Render bind casts for :attr:`.BindTyping.RENDER_CASTS` mode. |
Class Variable | render |
render casts when rendering a value as an inline literal, e.g. with :meth:`.TypeEngine.literal_processor`. |
Class Variable | sort |
A sorting function that can be passed as the key to sorted. |
Static Method | _to |
Undocumented |
Method | _cached |
Return a dialect-specific bind processor for this type. |
Method | _cached |
return a dialect-specific processing object for custom purposes. |
Method | _cached |
Return a dialect-specific literal processor for this type. |
Method | _cached |
Return a dialect-specific result processor for this type. |
Method | _compare |
Undocumented |
Method | _default |
Undocumented |
Method | _dialect |
Return a dialect-specific registry which caches a dialect-specific implementation, bind processing function, and one or more result processing functions. |
Method | _gen |
Undocumented |
Method | _resolve |
adjust this type given a literal Python value that will be stored in a bound parameter. |
Method | _resolve |
given a Python type (e.g. ``int``, ``str``, etc. ) return an instance of this :class:`.TypeEngine` that's appropriate for this type. |
Method | _unwrapped |
Return the 'unwrapped' dialect impl for this type. |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _isnull |
Undocumented |
Class Variable | _sqla |
Undocumented |
Property | _generic |
Undocumented |
Property | _has |
memoized boolean, check if bind_expression is implemented. |
Property | _has |
memoized boolean, check if column_expression is implemented. |
Property | _type |
Return a rudimental 'affinity' value expressing the general class of type. |
Inherited from Visitable
(via JSON
, JSON
, Indexable
, TypeEngineMixin
, TypeEngine
):
Method | __class |
Undocumented |
Method | __init |
Undocumented |
Class Method | _generate |
Undocumented |
Method | _compiler |
Undocumented |
Class Variable | _original |
Undocumented |