@@ -28,8 +28,8 @@ or alternatively if you have pip installed::
28
28
How to Use
29
29
----------
30
30
31
- Flask-SQLAlchemy is fun to use, and for the basic applications also
32
- incredible easy. For the complete guide, checkout out the API
31
+ Flask-SQLAlchemy is fun to use, and incredibly easy for basic applications.
32
+ For the complete guide, checkout out the API
33
33
documentation on the :class: `SQLAlchemy ` class.
34
34
35
35
Basically all you have to do is to create an :class: `SQLAlchemy ` object
@@ -61,7 +61,7 @@ and use this to declare models. Here a complete example::
61
61
def __repr__(self):
62
62
return '<User %r>' % self.username
63
63
64
- So how to create that database, just import the `db ` object from your
64
+ To create the initial database, just import the `db ` object from a
65
65
interactive Python shell and run the :meth: `~SQLAlchemy.create_all ` method
66
66
to create the tables and database:
67
67
@@ -74,7 +74,7 @@ Boom, and there is your database. Now to create some users:
74
74
>>> admin = User(' admin' , ' open sesame' )
75
75
>>> guest = User(' guest' , ' i-shall-pass' )
76
76
77
- But they are still not in the database, so let's make sure they are:
77
+ But they are not yet in the database, so let's make sure they are:
78
78
79
79
>>> db.session.add(admin)
80
80
>>> db.session.add(guest)
@@ -90,17 +90,16 @@ And how do you get the data back? Easy as pie:
90
90
Road to Enlightenment
91
91
---------------------
92
92
93
- All you need to know compared to plain SQLAlchemy is this :
93
+ The only things you need to know compared to plain SQLAlchemy are :
94
94
95
95
1. :class: `SQLAlchemy ` gives you access to the following things:
96
96
97
97
- all the functions and classes from :mod: `sqlalchemy ` and
98
98
:mod: `sqlalchemy.orm `
99
99
- a preconfigured scoped session called `session `
100
100
- the `metadata `
101
- - as well as a :meth: `SQLAlchemy.create_all ` and
102
- :meth: `SQLAlchemy.drop_all ` methods to create and drop
103
- tables according to the models.
101
+ - a :meth: `SQLAlchemy.create_all ` and :meth: `SQLAlchemy.drop_all `
102
+ methods to create and drop tables according to the models.
104
103
- a :class: `Model ` baseclass that is a configured declarative base.
105
104
106
105
2. The :class: `Model ` declarative base class behaves like a regular
@@ -121,7 +120,7 @@ The following configuration values exist for Flask-SQLAlchemy:
121
120
.. tabularcolumns :: |p{6.5cm}|p{8.5cm}|
122
121
123
122
=============================== =========================================
124
- ``SQLALCHEMY_DATABASE_URI `` the database URI that should be used for
123
+ ``SQLALCHEMY_DATABASE_URI `` The database URI that should be used for
125
124
the connection. Examples:
126
125
127
126
- ``sqlite:////tmp/test.db ``
@@ -139,14 +138,14 @@ The following configuration values exist for Flask-SQLAlchemy:
139
138
some database adapters like postgres when
140
139
used with inproper database defaults that
141
140
specify encoding-less databases (like
142
- postgres on some ubuntu versions)
143
- ``SQLALCHEMY_POOL_SIZE `` the size of the database pool. Defaults
144
- to engine defaults (usually 5)
145
- ``SQLALCHEMY_POOL_TIMEOUT `` specifies the connection timeout for the
146
- pool. Defaults to 10
147
- ``SQLALCHEMY_POOL_RECYCLE `` number of sections after which a
141
+ postgres on some Ubuntu versions)
142
+ ``SQLALCHEMY_POOL_SIZE `` The size of the database pool. Defaults
143
+ to the engine's default (usually 5)
144
+ ``SQLALCHEMY_POOL_TIMEOUT `` Specifies the connection timeout for the
145
+ pool. Defaults to 10.
146
+ ``SQLALCHEMY_POOL_RECYCLE `` Number of seconds after which a
148
147
connection is automatically recycled.
149
- This is required for MySQL that removes
148
+ This is required for MySQL, which removes
150
149
connections after 8 hours idle by
151
150
default. Note that Flask-SQLAlchemy
152
151
automatically sets this to 2 hours if
@@ -161,8 +160,8 @@ The following configuration values exist for Flask-SQLAlchemy:
161
160
API
162
161
---
163
162
164
- This part of the documentation documents each and every public class or
165
- function from Flask-SQLAlchemy.
163
+ This part of the documentation documents all the public classes and
164
+ functions in Flask-SQLAlchemy.
166
165
167
166
Configuration
168
167
`````````````
@@ -179,11 +178,6 @@ Models
179
178
.. autoclass :: BaseQuery
180
179
:members: get, get_or_404, paginate, first_or_404
181
180
182
- .. method :: get(ident)
183
-
184
- Return an instance of the object based on the given identifier
185
- (primary key), or `None ` if not found.
186
-
187
181
.. method :: all()
188
182
189
183
Return the results represented by this query as a list. This
0 commit comments