Пример #1
0
def import_auxiliary(req, dbname):
    db = TamerDB(dbname)
    schema = source_schema
    #try:
    table = req.POST['tablename']
    obj = req.POST['object']
    #except:
	#    return HttpResponse(simplejson.dumps({'status': 'fail'}),
    #                        mimetype='application/json')
 
    att = req.POST['attribute'] if 'attribute' in req.POST else None
    column = req.POST['columnname'] if 'columnname' in req.POST else None
    columna = req.POST['columna'] if 'columna' in req.POST else None
    columnb = req.POST['columnb'] if 'columnb' in req.POST else None
    template = req.POST['templatename'] if 'templatename' in req.POST else None

    if obj == 'attdict':
        db.import_attribute_dictionary(att, schema, table, column)
    elif obj == 'syndict':
        db.import_synonym_dictionary(att, schema, table, columna, columnb)
    elif obj == 'schema':
        db.import_global_schema(schema, table, column)
    elif obj == 'template':
        db.import_attribute_template(template, schema, table, column)

    return HttpResponse(simplejson.dumps({'status': 'success'}),
                        mimetype='application/json')
Пример #2
0
def import_auxiliary(req, dbname):
    db = TamerDB(dbname)
    schema = source_schema
    #try:
    table = req.POST['tablename']
    obj = req.POST['object']
    #except:
    #    return HttpResponse(simplejson.dumps({'status': 'fail'}),
    #                        mimetype='application/json')

    att = req.POST['attribute'] if 'attribute' in req.POST else None
    column = req.POST['columnname'] if 'columnname' in req.POST else None
    columna = req.POST['columna'] if 'columna' in req.POST else None
    columnb = req.POST['columnb'] if 'columnb' in req.POST else None
    template = req.POST['templatename'] if 'templatename' in req.POST else None

    if obj == 'attdict':
        db.import_attribute_dictionary(att, schema, table, column)
    elif obj == 'syndict':
        db.import_synonym_dictionary(att, schema, table, columna, columnb)
    elif obj == 'schema':
        db.import_global_schema(schema, table, column)
    elif obj == 'template':
        db.import_attribute_template(template, schema, table, column)

    return HttpResponse(simplejson.dumps({'status': 'success'}),
                        mimetype='application/json')