Python sqlalchemy.orm.relation() Examples
The following are 2
code examples of sqlalchemy.orm.relation().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sqlalchemy.orm
, or try the search function
.
Example #1
Source File: metamodel.py From SSRFTest with MIT License | 6 votes |
def Model(func): cframe = [None] def trace(frame, event, arg): if cframe[0] is None: cframe[0] = frame sys.settrace(trace) func() sys.settrace(None) frame = cframe[0] names = list(func.func_code.co_varnames) elems = {name : frame.f_locals[name] for name in names} cls = type(func.__name__, (object, ), elems) cls._fields = names cls.create = create cls.update = update cls.all = all cls.some = some cls.one = one cls.relation = relation Model.classes.append(cls) return cls
Example #2
Source File: metamodel.py From SSRFTest with MIT License | 5 votes |
def relation(cls, *args, **kwargs): return orm.relation(cls, *args, **kwargs)