Esempio n. 1
0
def tables(ctx):
    id_replacer = lambda data_key, prop_key, prop_value: next( prop['id'] for prop in ctx.obj[data_key] if prop[prop_key]==prop_value )
    tables = [replace_linked_props(ctx, table, id_replacer, ('tenant_id', 'schema_id'))
            for table in data.get('tables', [])]
    ctx.obj['tables'] = [create_table(ctx, table)
            for table in tables]
    return ctx.obj['tables']
Esempio n. 2
0
def schemas(ctx):
    id_replacer = lambda data_key, prop_key, prop_value: next( prop['id'] for prop in ctx.obj[data_key] if prop[prop_key]==prop_value )
    schemas = [replace_linked_props(ctx, schema, id_replacer, ('tenant_id',))
            for schema in data.get('schemas', [])]
    ctx.obj['schemas'] = [create_schema(ctx, schema)
            for schema in schemas]
    return ctx.obj['schemas']
Esempio n. 3
0
def instances(ctx):
    id_replacer = lambda data_key, prop_key, prop_value: next( prop['id'] for prop in ctx.obj[data_key] if prop[prop_key]==prop_value )
    instances = [replace_linked_props(ctx, instance, id_replacer, ('tenant_id', 'schema_id', 'table_id'))
            for instance in data.get('instances', [])]
    ctx.obj['instances'] = [create_instance(ctx, instance)
            for instance in instances]
    return ctx.obj['instances']
Esempio n. 4
0
def fields(ctx):
    id_replacer = lambda data_key, prop_key, prop_value: next( prop['id'] for prop in ctx.obj[data_key] if prop[prop_key]==prop_value )
    pdb.set_trace()
    fields = [replace_linked_props(ctx, field, id_replacer, ('tenant_id', 'schema_id', 'table_id'))
            for field in data.get('fields', [])]
    ctx.obj['fields'] = [create_field(ctx, field)
            for field in fields]
    return ctx.obj['fields']
Esempio n. 5
0
def tenants(ctx):
    ctx.obj['tenants'] = [create_tenant(ctx, tenant) 
            for tenant in data.get('tenants', [])]
    return ctx.obj['schemas']