diff --git a/docs/index.rst b/docs/index.rst index fdecd0667..4684fb9cb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 ` Contents: diff --git a/docs/mysql.png b/docs/mysql.png new file mode 100644 index 000000000..be24aae4c Binary files /dev/null and b/docs/mysql.png differ diff --git a/docs/peewee/cookbook.rst b/docs/peewee/cookbook.rst index 87a88e6de..5f67d5fd6 100644 --- a/docs/peewee/cookbook.rst +++ b/docs/peewee/cookbook.rst @@ -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 ^^^^^^^^^^^^^^^^^^^^^ @@ -109,6 +111,8 @@ Point models at an instance of :py:class:`PostgresqlDatabase`. # etc, etc +.. _mysql: + Using with MySQL ^^^^^^^^^^^^^^^^ @@ -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 `_, +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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/peewee/playhouse.rst b/docs/peewee/playhouse.rst index 6d081badd..864324a6d 100644 --- a/docs/peewee/playhouse.rst +++ b/docs/peewee/playhouse.rst @@ -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 ------------------------------- diff --git a/docs/peewee/upgrading.rst b/docs/peewee/upgrading.rst index 51e10fffd..fc755464a 100644 --- a/docs/peewee/upgrading.rst +++ b/docs/peewee/upgrading.rst @@ -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 --------------------- diff --git a/docs/postgresql.png b/docs/postgresql.png new file mode 100644 index 000000000..dbfe9dc8b Binary files /dev/null and b/docs/postgresql.png differ diff --git a/docs/sqlite.png b/docs/sqlite.png new file mode 100644 index 000000000..4c3ab9eca Binary files /dev/null and b/docs/sqlite.png differ