@@ -7,7 +7,7 @@ SQLAlchemy: Working with special CrateDB types
77This section of the documentation shows how to work with special data types
88from the CrateDB SQLAlchemy dialect. Currently, these are:
99
10- - Container types ``Object `` and ``ObjectArray ``.
10+ - Container types ``ObjectType `` and ``ObjectArray ``.
1111- Geospatial types ``Geopoint `` and ``Geoshape ``.
1212
1313
@@ -33,7 +33,7 @@ Import the relevant symbols:
3333 ... except ImportError :
3434 ... from sqlalchemy.ext.declarative import declarative_base
3535 >>> from uuid import uuid4
36- >>> from crate.client.sqlalchemy.types import Object , ObjectArray
36+ >>> from crate.client.sqlalchemy.types import ObjectType , ObjectArray
3737 >>> from crate.client.sqlalchemy.types import Geopoint, Geoshape
3838
3939Establish a connection to the database, see also :ref: `sa:engines_toplevel `
@@ -53,9 +53,9 @@ Introduction to container types
5353
5454In a document oriented database, it is a common pattern to store objects within
5555a single field. For such cases, the CrateDB SQLAlchemy dialect provides the
56- ``Object `` and ``ObjectArray `` types.
56+ ``ObjectType `` and ``ObjectArray `` types.
5757
58- The ``Object `` type effectively implements a dictionary- or map-like type. The
58+ The ``ObjectType `` type effectively implements a dictionary- or map-like type. The
5959``ObjectArray `` type maps to a Python list of dictionaries.
6060
6161For exercising those features, let's define a schema using SQLAlchemy's
@@ -69,15 +69,15 @@ For exercising those features, let's define a schema using SQLAlchemy's
6969 ... id = sa.Column(sa.String, primary_key = True , default = gen_key)
7070 ... name = sa.Column(sa.String)
7171 ... quote = sa.Column(sa.String)
72- ... details = sa.Column(Object )
72+ ... details = sa.Column(ObjectType )
7373 ... more_details = sa.Column(ObjectArray)
7474
7575In CrateDB's SQL dialect, those container types map to :ref: `crate-reference:type-object `
7676and :ref: `crate-reference:type-array `.
7777
7878
79- ``Object ``
80- ==========
79+ ``ObjectType ``
80+ ==============
8181
8282Let's add two records which have additional items within the ``details `` field.
8383Note that item keys have not been defined in the DDL schema, effectively
@@ -113,7 +113,7 @@ A subsequent select query will see all the records:
113113 [('Arthur Dent', 'male'), ('Tricia McMillan', 'female')]
114114
115115It is also possible to just select a part of the document, even inside the
116- ``Object `` type:
116+ ``ObjectType `` type:
117117
118118 >>> sorted (session.query(Character.details[' gender' ]).all())
119119 [('female',), ('male',)]
@@ -129,7 +129,7 @@ Update dictionary
129129-----------------
130130
131131The SQLAlchemy CrateDB dialect supports change tracking deep down the nested
132- levels of a ``Object `` type field. For example, the following query will only
132+ levels of a ``ObjectType `` type field. For example, the following query will only
133133update the ``gender `` key. The ``species `` key which is on the same level will
134134be left untouched.
135135
@@ -170,7 +170,7 @@ Refresh and query "characters" table:
170170``ObjectArray ``
171171===============
172172
173- Note that opposed to the ``Object `` type, the ``ObjectArray `` type isn't smart
173+ Note that opposed to the ``ObjectType `` type, the ``ObjectArray `` type isn't smart
174174and doesn't have intelligent change tracking. Therefore, the generated
175175``UPDATE `` statement will affect the whole list:
176176
0 commit comments