1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
API
===
Extension
---------
.. module:: flask_sqlalchemy
.. autoclass:: SQLAlchemy
:members:
Model
-----
.. module:: flask_sqlalchemy.model
.. autoclass:: Model
:members:
.. attribute:: __bind_key__
Use this bind key to select a metadata and engine to associate with this model's
table. Ignored if ``metadata`` or ``__table__`` is set. If not given, uses the
default key, ``None``.
.. attribute:: __tablename__
The name of the table in the database. This is required by SQLAlchemy; however,
Flask-SQLAlchemy will set it automatically if a model has a primary key defined.
If the ``__table__`` or ``__tablename__`` is set explicitly, that will be used
instead.
Metaclass mixins (SQLAlchemy 1.x)
---------------------------------
If your code uses the SQLAlchemy 1.x API (the default for code that doesn't specify a ``model_class``),
then these mixins are automatically applied to the ``Model`` class.
.. autoclass:: DefaultMeta
.. autoclass:: BindMetaMixin
.. autoclass:: NameMetaMixin
Session
-------
.. module:: flask_sqlalchemy.session
.. autoclass:: Session
:members:
Pagination
----------
.. module:: flask_sqlalchemy.pagination
.. class:: Pagination
A slice of the total items in a query obtained by applying an offset and limit to
based on the current page and number of items per page.
Don't create pagination objects manually. They are created by
:meth:`.SQLAlchemy.paginate` and :meth:`.Query.paginate`.
.. versionchanged:: 3.0
Iterating over a pagination object iterates over its items.
.. versionchanged:: 3.0
Creating instances manually is not a public API.
.. autoattribute:: page
.. autoattribute:: per_page
.. autoattribute:: items
.. autoattribute:: total
.. autoproperty:: first
.. autoproperty:: last
.. autoproperty:: pages
.. autoproperty:: has_prev
.. autoproperty:: prev_num
.. automethod:: prev
.. autoproperty:: has_next
.. autoproperty:: next_num
.. automethod:: next
.. automethod:: iter_pages
Query
-----
.. module:: flask_sqlalchemy.query
.. autoclass:: Query
:members:
Record Queries
--------------
.. module:: flask_sqlalchemy.record_queries
.. autofunction:: get_recorded_queries
Track Modifications
-------------------
.. module:: flask_sqlalchemy.track_modifications
.. autodata:: models_committed
:no-value:
.. autodata:: before_models_committed
:no-value:
|