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_session


db = Database()

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


class MyService(object):
    name = "my_service"

    pony_session = PonySession(db)

    @rpc
    def hello(self, name):
        with self.pony_session:
            Person(name=name)


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

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.

Source Distribution

nameko-pony-1.2.5.win32.zip (4.2 kB view hashes)

Uploaded Source

Built Distribution

nameko_pony-1.2.5-py2-none-any.whl (2.5 kB view hashes)

Uploaded Python 2

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