Skip to content

Commit 2d77101

Browse files
committed
Chore: Update all imports to use sqlalchemy_cratedb, where applicable
1 parent 6037b5d commit 2d77101

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed

docs/advanced-querying.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Fulltext search in CrateDB is performed using :ref:`crate-reference:predicates_m
113113
The CrateDB SQLAlchemy dialect comes with a ``match`` function, which can be used to
114114
search on one or multiple fields.
115115

116-
>>> from crate.client.sqlalchemy.predicates import match
116+
>>> from sqlalchemy_cratedb.predicates import match
117117

118118
>>> session.query(Character.name) \
119119
... .filter(match(Character.name_ft, 'Arthur')) \

docs/crud.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Import the relevant symbols:
3232
... from sqlalchemy.orm import declarative_base
3333
... except ImportError:
3434
... from sqlalchemy.ext.declarative import declarative_base
35-
>>> from crate.client.sqlalchemy.types import ObjectArray
35+
>>> from sqlalchemy_cratedb import ObjectArray
3636

3737
Establish a connection to the database, see also :ref:`sa:engines_toplevel`
3838
and :ref:`connect`:

docs/dataframe.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The package provides a ``bulk_insert`` function to use the
7676
workload across multiple batches, using a defined chunk size.
7777

7878
>>> import sqlalchemy as sa
79-
>>> from crate.client.sqlalchemy.support import insert_bulk
79+
>>> from sqlalchemy_cratedb.support import insert_bulk
8080
>>> from pueblo.testing.pandas import makeTimeDataFrame
8181
...
8282
>>> # Define number of records, and chunk size.
@@ -159,7 +159,7 @@ in a batched/chunked manner, using a defined chunk size, effectively using the
159159
pandas implementation introduced in the previous section.
160160

161161
>>> import dask.dataframe as dd
162-
>>> from crate.client.sqlalchemy.support import insert_bulk
162+
>>> from sqlalchemy_cratedb.support import insert_bulk
163163
>>> from pueblo.testing.pandas import makeTimeDataFrame
164164
...
165165
>>> # Define the number of records, the number of computing partitions,

docs/inspection-reflection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ CrateDialect
9898

9999
After initializing the dialect instance with a connection instance,
100100

101-
>>> from crate.client.sqlalchemy.dialect import CrateDialect
101+
>>> from sqlalchemy_cratedb.dialect import CrateDialect
102102
>>> dialect = CrateDialect()
103103

104104
>>> connection = engine.connect()

docs/overview.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ Here is an example SQLAlchemy table definition using the :ref:`declarative
182182
system <sa:orm_declarative_mapping>`:
183183

184184
>>> from sqlalchemy.ext import declarative
185-
>>> from crate.client.sqlalchemy import types
186185
>>> from uuid import uuid4
186+
>>> from sqlalchemy_cratedb import ObjectType, ObjectArray
187187

188188
>>> def gen_key():
189189
... return str(uuid4())
@@ -201,8 +201,8 @@ system <sa:orm_declarative_mapping>`:
201201
... name = sa.Column(sa.String, crate_index=False)
202202
... name_normalized = sa.Column(sa.String, sa.Computed("lower(name)"))
203203
... quote = sa.Column(sa.String, nullable=False)
204-
... details = sa.Column(types.ObjectType)
205-
... more_details = sa.Column(types.ObjectArray)
204+
... details = sa.Column(ObjectType)
205+
... more_details = sa.Column(ObjectArray)
206206
... name_ft = sa.Column(sa.String)
207207
... quote_ft = sa.Column(sa.String)
208208
... even_more_details = sa.Column(sa.String, crate_columnstore=False)
@@ -439,12 +439,14 @@ The CrateDB SQLAlchemy dialect provides two geospatial types:
439439

440440
To use these types, you can create columns, like so:
441441

442+
>>> from sqlalchemy_cratedb import Geopoint, Geoshape
443+
442444
>>> class City(Base):
443445
...
444446
... __tablename__ = 'cities'
445447
... name = sa.Column(sa.String, primary_key=True)
446-
... coordinate = sa.Column(types.Geopoint)
447-
... area = sa.Column(types.Geoshape)
448+
... coordinate = sa.Column(Geopoint)
449+
... area = sa.Column(Geoshape)
448450

449451
A geopoint can be created in multiple ways. Firstly, you can define it as a
450452
:py:class:`py:tuple` of ``(longitude, latitude)``:
@@ -591,7 +593,7 @@ The CrateDB SQLAlchemy dialect provides a ``match`` function in the
591593

592594
Here's an example use of the ``match`` function:
593595

594-
>>> from crate.client.sqlalchemy.predicates import match
596+
>>> from sqlalchemy_cratedb.predicates import match
595597

596598
>>> session.query(Character.name) \
597599
... .filter(match(Character.name_ft, 'Arthur')) \

docs/working-with-types.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ 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 ObjectType, ObjectArray
37-
>>> from crate.client.sqlalchemy.types import Geopoint, Geoshape
3836

3937
Establish a connection to the database, see also :ref:`sa:engines_toplevel`
4038
and :ref:`connect`:
@@ -61,6 +59,8 @@ The ``ObjectType`` type effectively implements a dictionary- or map-like type. T
6159
For exercising those features, let's define a schema using SQLAlchemy's
6260
:ref:`sa:orm_declarative_mapping`:
6361

62+
>>> from sqlalchemy_cratedb import ObjectType, ObjectArray
63+
6464
>>> def gen_key():
6565
... return str(uuid4())
6666

@@ -216,6 +216,8 @@ CrateDB's geospatial types, such as :ref:`crate-reference:type-geo_point`
216216
and :ref:`crate-reference:type-geo_shape`, can also be used within an
217217
SQLAlchemy declarative schema:
218218

219+
>>> from sqlalchemy_cratedb import Geopoint, Geoshape
220+
219221
>>> class City(Base):
220222
... __tablename__ = 'cities'
221223
... name = sa.Column(sa.String, primary_key=True)

0 commit comments

Comments
 (0)