Beispiel #1
0
    TTableModel, Service, ResourceNotFoundError, UnsignedInteger32

from spyne.protocol.http import HttpRpc
from spyne.protocol.yaml import YamlDocument

from spyne.util import memoize

from spyne.server.wsgi import WsgiApplication

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker


db = create_engine('sqlite:///:memory:')
Session = sessionmaker(bind=db)
TableModel = TTableModel()
TableModel.Attributes.sqla_metadata.bind = db


class Permission(TableModel):
    __tablename__ = 'permission'
    __namespace__ = 'spyne.examples.sql_crud'
    __table_args__ = {"sqlite_autoincrement": True}

    id = UnsignedInteger32(primary_key=True)
    application = Unicode(256)
    operation = Unicode(256)


class User(TableModel):
    __tablename__ = 'user'
Beispiel #2
0
from sqlalchemy.orm import sessionmaker

from spyne import MethodContext, Application, rpc, TTableModel, Integer32, \
    UnsignedInteger, ByteArray, Mandatory as M

# client stuff
from spyne import RemoteService, RemoteProcedureBase, ClientBase

# server stuff
from spyne import ServerBase, ServiceBase

from spyne.protocol.soap import Soap11


db = create_engine('sqlite:///:memory:')
TableModel = TTableModel(MetaData(bind=db))


#
# The database tables used to store tasks and worker status
#


class TaskQueue(TableModel):
    __tablename__ = 'task_queue'

    id = Integer32(primary_key=True)
    data = ByteArray(nullable=False)


class WorkerStatus(TableModel):