Skip to main content

Pony dependency for nameko services

Project description

nameko-pony

Pony dependency for nameko services

Installation

pip install nameko-pony

Usage

app.py

from nameko.rpc import rpc
from pony.orm import Database, Required
from nameko_pony import PonySession

db = Database()


class Person(db.Entity):
    name = Required(str)


class FooService(object):
    name = 'foo_service'

    db_session = PonySession(db)

    @rpc
    @db_session
    def hello(self):
        Person(name='hello')
        Person(name='world')

    @rpc
    def world(self):
        with self.db_session:
            return [p.name for p in Person.select()]

config.yml

AMQP_URI: 'pyamqp://guest:guest@localhost'
DATABASE_URI: 'sqlite:///:memory:'
# DATABASE_URI: 'mysql://usr:pwd@localhost/db_name'

Project details


Download files

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

Files for nameko-pony, version 1.3.1
Filename, size File type Python version Upload date Hashes
Filename, size nameko_pony-1.3.1-py2-none-any.whl (2.5 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size nameko-pony-1.3.1.win32.zip (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page