Skip to content

Commit baae1ee

Browse files
committed
[no ci] improve docs
1 parent d93a69f commit baae1ee

11 files changed

Lines changed: 116 additions & 22 deletions

File tree

README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ code:
115115

116116
.. code-block:: python
117117
118-
from sqlalchemy_mate import EngineCreator
118+
from sqlalchemy_mate.api import EngineCreator
119119
120120
ec = EngineCreator.from_json(
121121
json_file="path-to-json-file",
@@ -149,7 +149,7 @@ You can put lots of database connection info in a ``.db.json`` file in your ``$H
149149

150150
.. code-block:: python
151151
152-
from sqlalchemy_mate import EngineCreator
152+
from sqlalchemy_mate.api import EngineCreator
153153
154154
ec = EngineCreator.from_home_db_json(identifier="db1")
155155
engine = ec.create_postgresql_psycopg2()
@@ -179,7 +179,7 @@ This is similar to ``from_json``, but the json file is stored on AWS S3.
179179

180180
.. code-block:: python
181181
182-
from sqlalchemy_mate import EngineCreator
182+
from sqlalchemy_mate.api import EngineCreator
183183
ec = EngineCreator.from_s3_json(
184184
bucket_name="my-bucket", key="db.json",
185185
json_path="identifier1",
@@ -203,7 +203,7 @@ You can put your credentials in Environment Variable. For example:
203203
204204
.. code-block:: python
205205
206-
from sqlalchemy_mate import EngineCreator
206+
from sqlalchemy_mate.api import EngineCreator
207207
# read from DB_DEV_USERNAME, DB_DEV_PASSWORD, ...
208208
ec = EngineCreator.from_env(prefix="DB_DEV")
209209
engine = ec.create_redshift()
@@ -239,7 +239,7 @@ With sql expression:
239239

240240
.. code-block:: python
241241
242-
from sqlalchemy_mate import inserting
242+
from sqlalchemy_mate.api import inserting
243243
engine = create_engine(...)
244244
t_users = Table(
245245
"users", metadata,
@@ -256,7 +256,7 @@ With ORM:
256256
257257
.. code-block:: python
258258
259-
from sqlalchemy_mate import ExtendedBase
259+
from sqlalchemy_mate.api import ExtendedBase
260260
Base = declarative_base()
261261
class User(Base, ExtendedBase): # inherit from ExtendedBase
262262
...
@@ -274,7 +274,7 @@ Automatically update value by primary key.
274274
.. code-block:: python
275275
276276
# in SQL expression
277-
from sqlalchemy_mate import updating
277+
from sqlalchemy_mate.api import updating
278278
279279
data = [{"id": 1, "name": "Alice}, {"id": 2, "name": "Bob"}, ...]
280280
updating.update_all(engine, table, data)

docs/source/01-Core-API/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ We want to insert 3 random user data into the database and do some basic query:
4444
4545
.. code-block:: python
4646
47-
import sqlalchemy_mate as sam
47+
import sqlalchemy_mate.api as sam
4848
4949
# do bulk insert
5050
sam.inserting.smart_insert(engine, t_users, user_data_list)

docs/source/02-ORM-API/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Extended Declarative Base
1212
1313
import sqlalchemy as sa
1414
import sqlalchemy.orm as orm
15-
import sqlalchemy_mate as sam
15+
import sqlalchemy_mate.api as sam
1616
1717
Base = orm.declarative_base()
1818

docs/source/03-Other-Helpers/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ User Friendly Engine Creator
1212

1313
.. code-block:: python
1414
15-
import sqlalchemy_mate as sam
15+
import sqlalchemy_mate.api as sam
1616
1717
# An Postgres DB example
1818
# First, you use EngineCreator class to create the db connection specs
@@ -48,7 +48,7 @@ First let's insert some sample data:
4848
4949
import sqlalchemy as sa
5050
from sqlalchemy.orm import declarative_base
51-
import sqlalchemy_mate as sam
51+
import sqlalchemy_mate.api as sam
5252
5353
Base = declarative_base()
5454
@@ -81,7 +81,7 @@ First let's insert some sample data:
8181

8282
.. code-block:: python
8383
84-
import sqlalchemy_mate as sam
84+
import sqlalchemy_mate.api as sam
8585
8686
# from ORM class
8787
print(sam.pt.from_everything(User, engine))

docs/source/05-Patterns/Status-Tracker/index.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
"\n",
253253
"The ``Job.start()`` class method is a magic context manager that does a lot of things.\n",
254254
"\n",
255-
"1. It try to obtain lock before the job begin. Once we have obtained the lock, other work won't be able to update this items (they will see that it is locked).\n",
255+
"1. Try to obtain lock before the job begin. Once we have obtained the lock, other work won't be able to update this row (they will see that it is locked).\n",
256256
"2. Any raised exception will be captured by the context manager, and it will set the status as ``failed``, add retry count, log the error (and save the error information to DB), and release the lock.\n",
257257
"3. If the job has been failed too many times, it will set the status as ``ignored``.\n",
258258
"4. If everything goes well, it will set status as ``succeeded`` and apply updates."

examples/e1_core_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
import sqlalchemy as sa
4-
import sqlalchemy_mate as sam
4+
import sqlalchemy_mate.api as sam
55

66
metadata = sa.MetaData()
77

examples/e2_orm_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sqlalchemy as sa
44
from sqlalchemy.orm import declarative_base, Session
5-
import sqlalchemy_mate as sam
5+
import sqlalchemy_mate.api as sam
66

77
Base = declarative_base()
88

examples/e31_engine_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
import sqlalchemy_mate as sam
3+
import sqlalchemy_mate.api as sam
44

55
engine_sqlite = sam.EngineCreator().create_sqlite(path="/tmp/db.sqlite")
66
sam.test_connection(engine_sqlite, timeout=1)

examples/e32_pretty_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sqlalchemy as sa
44
from sqlalchemy.orm import declarative_base
5-
import sqlalchemy_mate as sam
5+
import sqlalchemy_mate.api as sam
66

77
Base = declarative_base()
88

release-history.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,23 @@ Backlog (TODO)
1515
**Miscellaneous**
1616

1717

18-
2.0.0.0 (TODO)
18+
2.0.0.1 (TODO)
19+
------------------------------------------------------------------------------
20+
**💥Breaking Change**
21+
22+
- Rework the public API import. Now you have to use ``import sqlalchemy_mate.api as sm`` to access the public API. ``from sqlalchemy_mate import ...`` is no longer working.
23+
24+
**Features and Improvements**
25+
26+
- Add status tracker pattern.
27+
28+
29+
2.0.0.0 (2024-05-15)
1930
------------------------------------------------------------------------------
2031
**💥Breaking Change**
2132

2233
- From ``sqlalchemy_mate>=2.0.0.0``, it only support ``sqlalchemy>=2.0.0`` and only compatible with sqlalchemy 2.X API. Everything marked as ``no longer supported`` or ``no longer accepted`` in `SQLAlchemy 2.0 - Major Migration Guide <https://docs.sqlalchemy.org/en/20/changelog/migration_20.html#migration-core-connection-transaction>`_ document will no longer be supported from this version.
23-
- Drop Python3.7 support.
34+
- Drop Python3.7 support. Now it only support 3.8+.
2435

2536
**Features and Improvements**
2637

0 commit comments

Comments
 (0)