Skip to content

Commit fe710b7

Browse files
committed
Merge branch 'master' of github.com:mitsuhiko/flask-sqlalchemy
2 parents ded2343 + c2aa52b commit fe710b7

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

docs/index.rst

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ or alternatively if you have pip installed::
2828
How to Use
2929
----------
3030

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
3333
documentation on the :class:`SQLAlchemy` class.
3434

3535
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::
6161
def __repr__(self):
6262
return '<User %r>' % self.username
6363

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
6565
interactive Python shell and run the :meth:`~SQLAlchemy.create_all` method
6666
to create the tables and database:
6767

@@ -74,7 +74,7 @@ Boom, and there is your database. Now to create some users:
7474
>>> admin = User('admin', 'open sesame')
7575
>>> guest = User('guest', 'i-shall-pass')
7676

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:
7878

7979
>>> db.session.add(admin)
8080
>>> db.session.add(guest)
@@ -90,17 +90,16 @@ And how do you get the data back? Easy as pie:
9090
Road to Enlightenment
9191
---------------------
9292

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:
9494

9595
1. :class:`SQLAlchemy` gives you access to the following things:
9696

9797
- all the functions and classes from :mod:`sqlalchemy` and
9898
:mod:`sqlalchemy.orm`
9999
- a preconfigured scoped session called `session`
100100
- 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.
104103
- a :class:`Model` baseclass that is a configured declarative base.
105104

106105
2. The :class:`Model` declarative base class behaves like a regular
@@ -121,7 +120,7 @@ The following configuration values exist for Flask-SQLAlchemy:
121120
.. tabularcolumns:: |p{6.5cm}|p{8.5cm}|
122121

123122
=============================== =========================================
124-
``SQLALCHEMY_DATABASE_URI`` the database URI that should be used for
123+
``SQLALCHEMY_DATABASE_URI`` The database URI that should be used for
125124
the connection. Examples:
126125

127126
- ``sqlite:////tmp/test.db``
@@ -139,14 +138,14 @@ The following configuration values exist for Flask-SQLAlchemy:
139138
some database adapters like postgres when
140139
used with inproper database defaults that
141140
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
148147
connection is automatically recycled.
149-
This is required for MySQL that removes
148+
This is required for MySQL, which removes
150149
connections after 8 hours idle by
151150
default. Note that Flask-SQLAlchemy
152151
automatically sets this to 2 hours if
@@ -161,8 +160,8 @@ The following configuration values exist for Flask-SQLAlchemy:
161160
API
162161
---
163162

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.
166165

167166
Configuration
168167
`````````````
@@ -179,11 +178,6 @@ Models
179178
.. autoclass:: BaseQuery
180179
:members: get, get_or_404, paginate, first_or_404
181180

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-
187181
.. method:: all()
188182

189183
Return the results represented by this query as a list. This

flaskext/sqlalchemy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def get_debug_queries():
120120
121121
`start_time` / `end_time`
122122
Time the query started / the results arrived. Please keep in mind
123-
that the timer function used for your platform might different this
123+
that the timer function used depends on your platform. These
124124
values are only useful for sorting or comparing. They do not
125125
necessarily represent an absolute timestamp.
126126
@@ -206,7 +206,7 @@ def iter_pages(self, left_edge=2, left_current=2,
206206
<div class=pagination>
207207
{%- for page in pagination.iter_pages() %}
208208
{% if page %}
209-
{% if page != pagination.numbers %}
209+
{% if page != pagination.page %}
210210
<a href="{{ url_for(endpoint, page=page) }}">{{ page }}</a>
211211
{% else %}
212212
<strong>{{ page }}</strong>
@@ -359,7 +359,7 @@ def create_app():
359359
360360
The difference between the two is that in the first case methods like
361361
:meth:`create_all` and :meth:`drop_all` will work all the time but in
362-
the section case a :meth:`flask.Flask.request_context` has to exist.
362+
the second case a :meth:`flask.Flask.request_context` has to exist.
363363
364364
By default Flask-SQLAlchemy will apply some backend-specific settings
365365
to improve your experience with them. As of SQLAlchemy 0.6 SQLAlchemy

0 commit comments

Comments
 (0)