Skip to content

Commit

Permalink
Adding docs for sqlite and images
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Dec 9, 2012
1 parent c4aa8ed commit 514d403
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 2 deletions.
15 changes: 14 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@
peewee
======

* a small orm
* a small, expressive orm
* written in python

.. image:: postgresql.png
:target: peewee/cookbook.html#using-with-postgresql
:alt: postgresql

.. image:: mysql.png
:target: peewee/cookbook.html#using-with-mysql
:alt: mysql

.. image:: sqlite.png
:target: peewee/cookbook.html#using-with-sqlite
:alt: sqlite


See notes on :ref:`notes on upgrading and changes from 1.0 <upgrading>`

Contents:
Expand Down
Binary file added docs/mysql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions docs/peewee/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ you wish to use, and then all your models will extend it:
otherwise peewee will fall back to a default sqlite database named "peewee.db".


.. _postgresql:

Using with Postgresql
^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -109,6 +111,8 @@ Point models at an instance of :py:class:`PostgresqlDatabase`.
# etc, etc
.. _mysql:

Using with MySQL
^^^^^^^^^^^^^^^^

Expand All @@ -133,6 +137,34 @@ Point models at an instance of :py:class:`MySQLDatabase`.
mysql_db.connect()
.. _sqlite:

Using with SQLite
^^^^^^^^^^^^^^^^^

Point models at an instance of :py:class:`SqliteDatabase`. See also :ref:`Alternate Python SQLite Driver <apsw>`_,
it's really neat.


.. code-block:: python

sqlite_db = SqliteDatabase('sq.db')


class SqliteModel(Model):
"""A base model that will use our Sqlite database"""
class Meta:
database = sqlite_db

class User(SqliteModel):
username = CharField()
# etc, etc


# when you're ready to start querying, remember to connect
sqlite_db.connect()


Multi-threaded applications
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions docs/peewee/playhouse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Peewee comes with numerous extras which I didn't really feel like including in
the main source module, but which might be interesting to implementers or fun
to mess around with.

.. _apsw:

apsw, an advanced sqlite driver
-------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/peewee/upgrading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Upgrading peewee
================

Peewee went from 2319 SLOC to 1666.
Peewee went from 2319 source lines of code to ~1600 between 1.0 and 2.0.

Goals for the new API
---------------------
Expand Down
Binary file added docs/postgresql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/sqlite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 514d403

Please sign in to comment.