Skip to main content

Peewee integration to Muffin framework

Project description

Muffin Peewee Async
#############

.. _description:

Muffin Peewee Async -- Peewee integration to Muffin framework using peewee-async.

Based on https://github.com/klen/muffin-peewee with an ability to execute asynchronous queries.


Installation
=============

**Muffin Peewee Async** should be installed using pip: ::

pip install muffin-peewee-async


Usage
=====

Add `muffin_peewee_async` to `PLUGINS` in your Muffin Application configuration.

Or install it manually like this: ::

db = muffin_peewee_async.Plugin(**{'options': 'here'})

app = muffin.Application('test')
app.install(db)


Options
-------

`PEEWEE_ASYNC_CONNECTION` -- connection string to your database (postgres://postgres:postgres@127.0.0.1)

`PEEWEE_ASYNC_CONNECTION_PARAMS` -- Additional params for connection ({})

`PEEWEE_ASYNC_MIGRATIONS_PATH` -- path to migration folder (migrations)

Queries
-------

::
import peewee_async

@app.ps.peewee_async.register
class Test(peewee.Model):
data = peewee.CharField()


@app.register
async def view(request):
tests = await peewee_async.select(Test.select())
return [t.data for t in tests]


Migrations
----------

Create migrations: ::

$ muffin example:app pw_create [NAME] [--auto]


Run migrations: ::

$ muffin example:app pw_migrate [NAME] [--fake]


Rollback migrations: ::

$ muffin example:app pw_rollback NAME


Load/Dump data to CSV
---------------------

Dump table `test` to CSV file: ::

$ muffin example:app pw_dump test


Load data from CSV file to table `test`: ::

$ muffin example:app pw_load test


.. _bugtracker:

Bug tracker
===========

If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/serathius/muffin-peewee-async/issues

.. _contributing:

Contributing
============

Development of Muffin Peewee Async happens at: https://github.com/serathius/muffin-peewee-async


Contributors
=============

* serathius (Marek Siarkowicz)

.. _license:

License
=======

Licensed under a `MIT license`_.

.. _links:

.. _MIT license: http://opensource.org/licenses/MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muffin-peewee-async-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file muffin-peewee-async-0.1.0.tar.gz.

File metadata

File hashes

Hashes for muffin-peewee-async-0.1.0.tar.gz
Algorithm Hash digest
SHA256 20f13ff904d3a91b8cc1c7ede6ab6af64d961812e3b02c5e40f430b7f957fe14
MD5 99bce75c011bb9208c5eac12bdc376e2
BLAKE2b-256 38e485a19e7283bdd9375f34e24830d2c1094c9509f9bf219fb470144d61b571

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page