Debian Codegraph @

docs/api.rst

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