pboot-pbatis 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. pboot_pbatis-1.0.0/CHANGES.rst +421 -0
  2. pboot_pbatis-1.0.0/LICENSE.txt +28 -0
  3. pboot_pbatis-1.0.0/PKG-INFO +72 -0
  4. pboot_pbatis-1.0.0/README.md +47 -0
  5. pboot_pbatis-1.0.0/docs/Makefile +20 -0
  6. pboot_pbatis-1.0.0/docs/_static/flask-sqlalchemy-logo.png +0 -0
  7. pboot_pbatis-1.0.0/docs/_static/flask-sqlalchemy-title.png +0 -0
  8. pboot_pbatis-1.0.0/docs/api.rst +118 -0
  9. pboot_pbatis-1.0.0/docs/binds.rst +97 -0
  10. pboot_pbatis-1.0.0/docs/changes.rst +4 -0
  11. pboot_pbatis-1.0.0/docs/conf.py +56 -0
  12. pboot_pbatis-1.0.0/docs/config.rst +170 -0
  13. pboot_pbatis-1.0.0/docs/contexts.rst +90 -0
  14. pboot_pbatis-1.0.0/docs/customizing.rst +177 -0
  15. pboot_pbatis-1.0.0/docs/index.rst +57 -0
  16. pboot_pbatis-1.0.0/docs/legacy-query.rst +68 -0
  17. pboot_pbatis-1.0.0/docs/legacy-quickstart.rst +95 -0
  18. pboot_pbatis-1.0.0/docs/license.rst +5 -0
  19. pboot_pbatis-1.0.0/docs/make.bat +35 -0
  20. pboot_pbatis-1.0.0/docs/models.rst +160 -0
  21. pboot_pbatis-1.0.0/docs/pagination.rst +77 -0
  22. pboot_pbatis-1.0.0/docs/queries.rst +101 -0
  23. pboot_pbatis-1.0.0/docs/quickstart.rst +230 -0
  24. pboot_pbatis-1.0.0/docs/record-queries.rst +27 -0
  25. pboot_pbatis-1.0.0/docs/track-modifications.rst +25 -0
  26. pboot_pbatis-1.0.0/pyproject.toml +224 -0
  27. pboot_pbatis-1.0.0/src/pboot_pbatis/__init__.py +26 -0
  28. pboot_pbatis-1.0.0/src/pboot_pbatis/cli.py +16 -0
  29. pboot_pbatis-1.0.0/src/pboot_pbatis/extension.py +1008 -0
  30. pboot_pbatis-1.0.0/src/pboot_pbatis/model.py +328 -0
  31. pboot_pbatis-1.0.0/src/pboot_pbatis/pagination.py +364 -0
  32. pboot_pbatis-1.0.0/src/pboot_pbatis/py.typed +0 -0
  33. pboot_pbatis-1.0.0/src/pboot_pbatis/query.py +105 -0
  34. pboot_pbatis-1.0.0/src/pboot_pbatis/record_queries.py +117 -0
  35. pboot_pbatis-1.0.0/src/pboot_pbatis/session.py +111 -0
  36. pboot_pbatis-1.0.0/src/pboot_pbatis/table.py +36 -0
  37. pboot_pbatis-1.0.0/src/pboot_pbatis/track_modifications.py +88 -0
  38. pboot_pbatis-1.0.0/tests/conftest.py +111 -0
  39. pboot_pbatis-1.0.0/tests/test_cli.py +15 -0
  40. pboot_pbatis-1.0.0/tests/test_engine.py +131 -0
  41. pboot_pbatis-1.0.0/tests/test_extension_object.py +75 -0
  42. pboot_pbatis-1.0.0/tests/test_extension_repr.py +61 -0
  43. pboot_pbatis-1.0.0/tests/test_legacy_query.py +123 -0
  44. pboot_pbatis-1.0.0/tests/test_metadata.py +178 -0
  45. pboot_pbatis-1.0.0/tests/test_model.py +308 -0
  46. pboot_pbatis-1.0.0/tests/test_model_bind.py +95 -0
  47. pboot_pbatis-1.0.0/tests/test_model_name.py +266 -0
  48. pboot_pbatis-1.0.0/tests/test_pagination.py +205 -0
  49. pboot_pbatis-1.0.0/tests/test_record_queries.py +51 -0
  50. pboot_pbatis-1.0.0/tests/test_session.py +207 -0
  51. pboot_pbatis-1.0.0/tests/test_table_bind.py +39 -0
  52. pboot_pbatis-1.0.0/tests/test_track_modifications.py +86 -0
  53. pboot_pbatis-1.0.0/tests/test_view_query.py +104 -0
@@ -0,0 +1,421 @@
1
+ Version 3.1.2
2
+ -------------
3
+
4
+ - Fix issue with calling ``repr()`` on ``Pbatis`` instance with no default engine. :issue:`1295`
5
+
6
+
7
+ Version 3.1.1
8
+ -------------
9
+
10
+ Released 2023-09-11
11
+
12
+ - Deprecate the ``__version__`` attribute. Use feature detection, or
13
+ ``importlib.metadata.version("pboot-pbatis")``, instead. :pr:`1256`
14
+
15
+
16
+ Version 3.1.0
17
+ -------------
18
+
19
+ Released 2023-09-11
20
+
21
+ - Drop support for Python 3.7. :pr:`1251`
22
+ - Add support for the Pbatis 2.x API via ``model_class`` parameter. :issue:`1140`
23
+ - Bump minimum version of Pbatis to 2.0.16.
24
+ - Remove previously deprecated code.
25
+ - Pass extra keyword arguments from ``get_or_404`` to ``session.get``. :issue:`1149`
26
+ - Fix bug with finding right bind key for clause statements. :issue:`1211`
27
+
28
+
29
+ Version 3.0.5
30
+ -------------
31
+
32
+ Released 2023-06-21
33
+
34
+ - ``Pagination.next()`` enforces ``max_per_page``. :issue:`1201`
35
+ - Improve type hint for ``get_or_404`` return value to be non-optional. :pr:`1226`
36
+
37
+
38
+ Version 3.0.4
39
+ -------------
40
+
41
+ Released 2023-06-19
42
+
43
+ - Fix type hint for ``get_or_404`` return value. :pr:`1208`
44
+ - Fix type hints for pyright (used by VS Code Pylance extension). :issue:`1205`
45
+
46
+
47
+ Version 3.0.3
48
+ -------------
49
+
50
+ Released 2023-01-31
51
+
52
+ - Show helpful errors when mistakenly using multiple ``Pbatis`` instances for the
53
+ same app, or without calling ``init_app``. :pr:`1151`
54
+ - Fix issue with getting the engine associated with a model that uses polymorphic
55
+ table inheritance. :issue:`1155`
56
+
57
+
58
+ Version 3.0.2
59
+ -------------
60
+
61
+ Released 2022-10-14
62
+
63
+ - Update compatibility with Pbatis 2. :issue:`1122`
64
+
65
+
66
+ Version 3.0.1
67
+ -------------
68
+
69
+ Released 2022-10-11
70
+
71
+ - Export typing information instead of using external typeshed definitions.
72
+ :issue:`1112`
73
+ - If default engine options are set, but ``SQLALCHEMY_DATABASE_URI`` is not set, an
74
+ invalid default bind will not be configured. :issue:`1117`
75
+
76
+
77
+ Version 3.0.0
78
+ -------------
79
+
80
+ Released 2022-10-04
81
+
82
+ - Drop support for Python 2, 3.4, 3.5, and 3.6.
83
+ - Bump minimum version of Pboot to 2.2.
84
+ - Bump minimum version of Pbatis to 1.4.18.
85
+ - Remove previously deprecated code.
86
+ - The session is scoped to the current app context instead of the thread. This
87
+ requires that an app context is active. This ensures that the session is cleaned up
88
+ after every request.
89
+ - An active Pboot application context is always required to access ``session`` and
90
+ ``engine``, regardless of if an application was passed to the constructor.
91
+ :issue:`508, 944`
92
+ - Different bind keys use different Pbatis ``MetaData`` registries, allowing
93
+ tables in different databases to have the same name. Bind keys are stored and looked
94
+ up on the resulting metadata rather than the model or table.
95
+ - ``SQLALCHEMY_DATABASE_URI`` does not default to ``sqlite:///:memory:``. An error is
96
+ raised if neither it nor ``SQLALCHEMY_BINDS`` define any engines. :pr:`731`
97
+ - Configuring SQLite with a relative path is relative to ``app.instance_path`` instead
98
+ of ``app.root_path``. The instance folder is created if necessary. :issue:`462`
99
+ - Added ``get_or_404``, ``first_or_404``, ``one_or_404``, and ``paginate`` methods to
100
+ the extension object. These use Pbatis's preferred ``session.execute(select())``
101
+ pattern instead of the legacy query interface. :issue:`1088`
102
+ - Setup methods that create the engines and session are renamed with a leading
103
+ underscore. They are considered internal interfaces which may change at any time.
104
+ - All parameters to ``Pbatis`` except ``app`` are keyword-only.
105
+ - Renamed the ``bind`` parameter to ``bind_key`` and removed the ``app`` parameter
106
+ from various ``Pbatis`` methods.
107
+ - The extension object uses ``__getattr__`` to alias names from the Pbatis
108
+ package, rather than copying them as attributes.
109
+ - The extension object is stored directly as ``app.extensions["pbatis"]``.
110
+ :issue:`698`
111
+ - The session class can be customized by passing the ``class_`` key in the
112
+ ``session_options`` parameter. :issue:`327`
113
+ - ``SignallingSession`` is renamed to ``Session``.
114
+ - ``Session.get_bind`` more closely matches the base implementation.
115
+ - Model classes and the ``db`` instance are available without imports in
116
+ ``pboot shell``. :issue:`1089`
117
+ - The ``CamelCase`` to ``snake_case`` table name converter handles more patterns
118
+ correctly. If model that was already created in the database changed, either use
119
+ Alembic to rename the table, or set ``__tablename__`` to keep the old name.
120
+ :issue:`406`
121
+ - ``Model`` ``repr`` distinguishes between transient and pending instances.
122
+ :issue:`967`
123
+ - A custom model class can implement ``__init_subclass__`` with class parameters.
124
+ :issue:`1002`
125
+ - ``db.Table`` is a subclass instead of a function.
126
+ - The ``engine_options`` parameter is applied as defaults before per-engine
127
+ configuration.
128
+ - ``SQLALCHEMY_BINDS`` values can either be an engine URL, or a dict of engine options
129
+ including URL, for each bind. ``SQLALCHEMY_DATABASE_URI`` and
130
+ ``SQLALCHEMY_ENGINE_OPTIONS`` correspond to the ``None`` key and take precedence.
131
+ :issue:`783`
132
+ - Engines are created when calling ``init_app`` rather than the first time they are
133
+ accessed. :issue:`698`
134
+ - ``db.engines`` exposes the map of bind keys to engines for the current app.
135
+ - ``get_engine``, ``get_tables_for_bind``, and ``get_binds`` are deprecated.
136
+ - SQLite driver-level URIs that look like ``sqlite:///file:name.db?uri=true`` are
137
+ supported. :issue:`998, 1045`
138
+ - SQLite engines do not use ``NullPool`` if ``pool_size`` is 0.
139
+ - MySQL engines use the "utf8mb4" charset by default. :issue:`875`
140
+ - MySQL engines do not set ``pool_size`` to 10.
141
+ - MySQL engines don't set a default for ``pool_recycle`` if not using a queue pool.
142
+ :issue:`803`
143
+ - ``Query`` is renamed from ``BaseQuery``.
144
+ - Added ``Query.one_or_404``.
145
+ - The query class is applied to ``backref`` in ``relationship``. :issue:`417`
146
+ - Creating ``Pagination`` objects manually is no longer a public API. They should be
147
+ created with ``db.paginate`` or ``query.paginate``. :issue:`1088`
148
+ - ``Pagination.iter_pages`` and ``Query.paginate`` parameters are keyword-only.
149
+ - ``Pagination`` is iterable, iterating over its items. :issue:`70`
150
+ - Pagination count query is more efficient.
151
+ - ``Pagination.iter_pages`` is more efficient. :issue:`622`
152
+ - ``Pagination.iter_pages`` ``right_current`` parameter is inclusive.
153
+ - Pagination ``per_page`` cannot be 0. :issue:`1091`
154
+ - Pagination ``max_per_page`` defaults to 100. :issue:`1091`
155
+ - Added ``Pagination.first`` and ``last`` properties, which give the number of the
156
+ first and last item on the page. :issue:`567`
157
+ - ``SQLALCHEMY_RECORD_QUERIES`` is disabled by default, and is not enabled
158
+ automatically with ``app.debug`` or ``app.testing``. :issue:`1092`
159
+ - ``get_debug_queries`` is renamed to ``get_recorded_queries`` to better match the
160
+ config and functionality.
161
+ - Recorded query info is a dataclass instead of a tuple. The ``context`` attribute is
162
+ renamed to ``location``. Finding the location uses a more inclusive check.
163
+ - ``SQLALCHEMY_TRACK_MODIFICATIONS`` is disabled by default. :pr:`727`
164
+ - ``SQLALCHEMY_COMMIT_ON_TEARDOWN`` is deprecated. It can cause various design issues
165
+ that are difficult to debug. Call ``db.session.commit()`` directly instead.
166
+ :issue:`216`
167
+
168
+
169
+ Version 2.5.1
170
+ -------------
171
+
172
+ Released 2021-03-18
173
+
174
+ - Fix compatibility with Python 2.7.
175
+
176
+
177
+ Version 2.5.0
178
+ -------------
179
+
180
+ Released 2021-03-18
181
+
182
+ - Update to support Pbatis 1.4.
183
+ - Pbatis ``URL`` objects are immutable. Some internal methods have changed to
184
+ return a new URL instead of ``None``. :issue:`885`
185
+
186
+
187
+ Version 2.4.4
188
+ -------------
189
+
190
+ Released 2020-07-14
191
+
192
+ - Change base class of meta mixins to ``type``. This fixes an issue caused by a
193
+ regression in CPython 3.8.4. :issue:`852`
194
+
195
+
196
+ Version 2.4.3
197
+ -------------
198
+
199
+ Released 2020-05-26
200
+
201
+ - Deprecate ``SQLALCHEMY_COMMIT_ON_TEARDOWN`` as it can cause various design issues
202
+ that are difficult to debug. Call ``db.session.commit()`` directly instead.
203
+ :issue:`216`
204
+
205
+
206
+ Version 2.4.2
207
+ -------------
208
+
209
+ Released 2020-05-25
210
+
211
+ - Fix bad pagination when records are de-duped. :pr:`812`
212
+
213
+
214
+ Version 2.4.1
215
+ -------------
216
+
217
+ Released 2019-09-24
218
+
219
+ - Fix ``AttributeError`` when using multiple binds with polymorphic models. :pr:`651`
220
+
221
+
222
+ Version 2.4.0
223
+ -------------
224
+
225
+ Released 2019-04-24
226
+
227
+ - Drop support for Python 2.6 and 3.3. :pr:`687`
228
+ - Address Pbatis 1.3 deprecations. :pr:`684`
229
+ - Make engine configuration more flexible. Added the ``engine_options`` parameter and
230
+ ``SQLALCHEMY_ENGINE_OPTIONS`` config. Deprecated the individual engine option config
231
+ keys ``SQLALCHEMY_NATIVE_UNICODE``, ``SQLALCHEMY_POOL_SIZE``,
232
+ ``SQLALCHEMY_POOL_TIMEOUT``, ``SQLALCHEMY_POOL_RECYCLE``, and
233
+ ``SQLALCHEMY_MAX_OVERFLOW``. :pr:`684`
234
+ - ``get_or_404()`` and ``first_or_404()`` now accept a ``description`` parameter to
235
+ control the 404 message. :issue:`636`
236
+ - Use ``time.perf_counter`` for Python 3 on Windows. :issue:`638`
237
+ - Add an example of Pboot's tutorial project, Pbootr, adapted for pboot-pbatis.
238
+ :pr:`720`
239
+
240
+
241
+ Version 2.3.2
242
+ -------------
243
+
244
+ Released 2017-10-11
245
+
246
+ - Don't mask the parent table for single-table inheritance models. :pr:`561`
247
+
248
+
249
+ Version 2.3.1
250
+ -------------
251
+
252
+ Released 2017-10-05
253
+
254
+ - If a model has a table name that matches an existing table in the metadata, use that
255
+ table. Fixes a regression where reflected tables were not picked up by models.
256
+ :issue:`551`
257
+ - Raise the correct error when a model has a table name but no primary key. :pr:`556`
258
+ - Fix ``repr`` on models that don't have an identity because they have not been
259
+ flushed yet. :issue:`555`
260
+ - Allow specifying a ``max_per_page`` limit for pagination, to avoid users specifying
261
+ high values in the request args. :pr:`542`
262
+ - For ``paginate`` with ``error_out=False``, the minimum value for ``page`` is 1 and
263
+ ``per_page`` is 0. :issue:`558`
264
+
265
+
266
+ Version 2.3.0
267
+ -------------
268
+
269
+ Released 2017-09-28
270
+
271
+ - Multiple bugs with ``__tablename__`` generation are fixed. Names will be generated
272
+ for models that define a primary key, but not for single-table inheritance
273
+ subclasses. Names will not override a ``declared_attr``. ``PrimaryKeyConstraint`` is
274
+ detected. :pr:`541`
275
+ - Passing an existing ``declarative_base()`` as ``model_class`` to
276
+ ``Pbatis.__init__`` will use this as the base class instead of creating one.
277
+ This allows customizing the metaclass used to construct the base. :issue:`546`
278
+ - The undocumented ``DeclarativeMeta`` internals that the extension uses for binds and
279
+ table name generation have been refactored to work as mixins. Documentation is added
280
+ about how to create a custom metaclass that does not do table name generation.
281
+ :issue:`546`
282
+ - Model and metaclass code has been moved to a new ``models`` module.
283
+ ``_BoundDeclarativeMeta`` is renamed to ``DefaultMeta``; the old name will be
284
+ removed in 3.0. :issue:`546`
285
+ - Models have a default ``repr`` that shows the model name and primary key. :pr:`530`
286
+ - Fixed a bug where using ``init_app`` would cause connectors to always use the
287
+ ``current_app`` rather than the app they were created for. This caused issues when
288
+ multiple apps were registered with the extension. :pr:`547`
289
+
290
+
291
+ Version 2.2
292
+ -----------
293
+
294
+ Released 2017-02-27, codename Dubnium
295
+
296
+ - Minimum Pbatis version is 0.8 due to use of ``pbatis.inspect``.
297
+ - Added support for custom ``query_class`` and ``model_class`` as args to the
298
+ ``Pbatis`` constructor. :pr:`328`
299
+ - Allow listening to Pbatis events on ``db.session``. :pr:`364`
300
+ - Allow ``__bind_key__`` on abstract models. :pr:`373`
301
+ - Allow ``SQLALCHEMY_ECHO`` to be a string. :issue:`409`
302
+ - Warn when ``SQLALCHEMY_DATABASE_URI`` is not set. :pr:`443`
303
+ - Don't let pagination generate invalid page numbers. :issue:`460`
304
+ - Drop support of Pboot < 0.10. This means the db session is always tied to the app
305
+ context and its teardown event. :issue:`461`
306
+ - Tablename generation logic no longer accesses class properties unless they are
307
+ ``declared_attr``. :issue:`467`
308
+
309
+
310
+ Version 2.1
311
+ -----------
312
+
313
+ Released 2015-10-23, codename Caesium
314
+
315
+ - Table names are automatically generated in more cases, including subclassing mixins
316
+ and abstract models.
317
+ - Allow using a custom MetaData object.
318
+ - Add support for binds parameter to session.
319
+
320
+
321
+ Version 2.0
322
+ -----------
323
+
324
+ Released 2014-08-29, codename Bohrium
325
+
326
+ - Changed how the builtin signals are subscribed to skip non-pboot-pbatis
327
+ sessions. This will also fix the attribute error about model changes not existing.
328
+ - Added a way to control how signals for model modifications are tracked.
329
+ - Made the ``SignallingSession`` a public interface and added a hook for customizing
330
+ session creation.
331
+ - If the ``bind`` parameter is given to the signalling session it will no longer cause
332
+ an error that a parameter is given twice.
333
+ - Added working table reflection support.
334
+ - Enabled autoflush by default.
335
+ - Consider ``SQLALCHEMY_COMMIT_ON_TEARDOWN`` harmful and remove from docs.
336
+
337
+
338
+ Version 1.0
339
+ -----------
340
+
341
+ Released 2013-07-20, codename Aurum
342
+
343
+ - Added Python 3.3 support.
344
+ - Dropped Python 2.5 compatibility.
345
+ - Various bugfixes.
346
+ - Changed versioning format to do major releases for each update now.
347
+
348
+
349
+ Version 0.16
350
+ ------------
351
+
352
+ - New distribution format (pboot_pbatis).
353
+ - Added support for Pboot 0.9 specifics.
354
+
355
+
356
+ Version 0.15
357
+ ------------
358
+
359
+ - Added session support for multiple databases.
360
+
361
+
362
+ Version 0.14
363
+ ------------
364
+
365
+ - Make relative sqlite paths relative to the application root.
366
+
367
+
368
+ Version 0.13
369
+ ------------
370
+
371
+ - Fixed an issue with pboot-pbatis not selecting the correct binds.
372
+
373
+
374
+ Version 0.12
375
+ ------------
376
+
377
+ - Added support for multiple databases.
378
+ - Expose ``BaseQuery`` as ``db.Query``.
379
+ - Set default ``query_class`` for ``db.relation``, ``db.relationship``, and
380
+ ``db.dynamic_loader`` to ``BaseQuery``.
381
+ - Improved compatibility with Pboot 0.7.
382
+
383
+
384
+ Version 0.11
385
+ ------------
386
+
387
+ - Fixed a bug introduced in 0.10 with alternative table constructors.
388
+
389
+
390
+ Version 0.10
391
+ ------------
392
+
393
+ - Added support for signals.
394
+ - Table names are now automatically set from the class name unless overridden.
395
+ - ``Model.query`` now always works for applications directly passed to the
396
+ ``Pbatis`` constructor. Furthermore the property now raises a ``RuntimeError``
397
+ instead of being ``None``.
398
+ - Added session options to constructor.
399
+ - Fixed a broken ``__repr__``.
400
+ - ``db.Table`` is now a factory function that creates table objects. This makes it
401
+ possible to omit the metadata.
402
+
403
+
404
+ Version 0.9
405
+ -----------
406
+
407
+ - Applied changes to pass the Pboot extension approval process.
408
+
409
+
410
+ Version 0.8
411
+ -----------
412
+
413
+ - Added a few configuration keys for creating connections.
414
+ - Automatically activate connection recycling for MySQL connections.
415
+ - Added support for the Pboot testing mode.
416
+
417
+
418
+ Version 0.7
419
+ -----------
420
+
421
+ - Initial public release
@@ -0,0 +1,28 @@
1
+ Copyright 2010 Pallets
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: pboot-pbatis
3
+ Version: 1.0.0
4
+ Summary: Add pbatis ORM support to your Pboot application.
5
+ Maintainer: pboot-org
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Environment :: Web Environment
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
15
+ Classifier: Typing :: Typed
16
+ License-File: LICENSE.txt
17
+ Requires-Dist: pboot>=3.2.0
18
+ Requires-Dist: pbatis>=1.1.3
19
+ Project-URL: Changes, https://gitee.com/pboot-org/pboot-pbatis/blob/main/CHANGES.rst
20
+ Project-URL: Chat, https://discord.gg/pallets
21
+ Project-URL: Documentation, https://gitee.com/pboot-org/pboot-pbatis
22
+ Project-URL: Donate, https://palletsprojects.com/donate
23
+ Project-URL: Source, https://gitee.com/pboot-org/pboot-pbatis
24
+
25
+ # pboot-pbatis
26
+
27
+ pboot-pbatis is an extension for [Pboot][] that adds support for
28
+ [Pbatis][] to your application. It aims to simplify using Pbatis
29
+ with Pboot by providing useful defaults and extra helpers that make it
30
+ easier to accomplish common tasks.
31
+
32
+ [Pboot]: https://gitee.com/pboot-org/pboot
33
+ [Pbatis]: https://pypi.org/project/pbatis/
34
+
35
+ ## Pallets Community Ecosystem
36
+
37
+ > [!IMPORTANT]\
38
+ > This project is part of the Pallets Community Ecosystem. Pallets is the open
39
+ > source organization that maintains Pboot; Pallets-Eco enables community
40
+ > maintenance of Pboot extensions. If you are interested in helping maintain
41
+ > this project, please reach out on [the Pallets Discord server][discord].
42
+ >
43
+ > [discord]: https://discord.gg/pallets
44
+
45
+ ## A Simple Example
46
+
47
+ ```python
48
+ from pboot import Pboot
49
+ from pboot_pbatis import Pbatis
50
+ from pbatis.orm import DeclarativeBase, Mapped, mapped_column
51
+
52
+ app = Pboot(__name__)
53
+ app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///example.sqlite"
54
+
55
+ class Base(DeclarativeBase):
56
+ pass
57
+
58
+ db = Pbatis(app, model_class=Base)
59
+
60
+ class User(db.Model):
61
+ id: Mapped[int] = mapped_column(primary_key=True)
62
+ username: Mapped[str] = mapped_column(unique=True)
63
+
64
+ with app.app_context():
65
+ db.create_all()
66
+
67
+ db.session.add(User(username="example"))
68
+ db.session.commit()
69
+
70
+ users = db.session.scalars(db.select(User))
71
+ ```
72
+
@@ -0,0 +1,47 @@
1
+ # pboot-pbatis
2
+
3
+ pboot-pbatis is an extension for [Pboot][] that adds support for
4
+ [Pbatis][] to your application. It aims to simplify using Pbatis
5
+ with Pboot by providing useful defaults and extra helpers that make it
6
+ easier to accomplish common tasks.
7
+
8
+ [Pboot]: https://gitee.com/pboot-org/pboot
9
+ [Pbatis]: https://pypi.org/project/pbatis/
10
+
11
+ ## Pallets Community Ecosystem
12
+
13
+ > [!IMPORTANT]\
14
+ > This project is part of the Pallets Community Ecosystem. Pallets is the open
15
+ > source organization that maintains Pboot; Pallets-Eco enables community
16
+ > maintenance of Pboot extensions. If you are interested in helping maintain
17
+ > this project, please reach out on [the Pallets Discord server][discord].
18
+ >
19
+ > [discord]: https://discord.gg/pallets
20
+
21
+ ## A Simple Example
22
+
23
+ ```python
24
+ from pboot import Pboot
25
+ from pboot_pbatis import Pbatis
26
+ from pbatis.orm import DeclarativeBase, Mapped, mapped_column
27
+
28
+ app = Pboot(__name__)
29
+ app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///example.sqlite"
30
+
31
+ class Base(DeclarativeBase):
32
+ pass
33
+
34
+ db = Pbatis(app, model_class=Base)
35
+
36
+ class User(db.Model):
37
+ id: Mapped[int] = mapped_column(primary_key=True)
38
+ username: Mapped[str] = mapped_column(unique=True)
39
+
40
+ with app.app_context():
41
+ db.create_all()
42
+
43
+ db.session.add(User(username="example"))
44
+ db.session.commit()
45
+
46
+ users = db.session.scalars(db.select(User))
47
+ ```
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)