@check_precondition
def create(self, gid, sid, did, scid, tid, cid=None):
    '\n        This function will create a primary key.\n\n        Args:\n          gid: Server Group ID\n          sid: Server ID\n          did: Database ID\n          scid: Schema ID\n          tid: Table ID\n          cid: Check constraint ID\n\n        Returns:\n\n        '
    required_args = ['consrc']
    data = (request.form if request.form else json.loads(request.data, encoding='utf-8'))
    for (k, v) in data.items():
        try:
            data[k] = json.loads(v, encoding='utf-8')
        except (ValueError, TypeError, KeyError):
            data[k] = v
    for arg in required_args:
        if ((arg not in data) or (data[arg] == '')):
            return make_json_response(status=400, success=0, errormsg=_(('Could not find the required parameter (%s).' % arg)))
    data['schema'] = self.schema
    data['table'] = self.table
    try:
        if (('name' not in data) or (data['name'] == '')):
            SQL = 'BEGIN;'
            (status, res) = self.conn.execute_scalar(SQL)
            if (not status):
                self.end_transaction()
                return internal_server_error(errormsg=res)
        SQL = render_template('/'.join([self.template_path, 'create.sql']), data=data)
        (status, msg) = self.conn.execute_scalar(SQL)
        if (not status):
            self.end_transaction()
            return internal_server_error(errormsg=msg)
        if (('name' not in data) or (data['name'] == '')):
            sql = render_template('/'.join([self.template_path, 'get_oid_with_transaction.sql']), tid=tid)
            (status, res) = self.conn.execute_dict(sql)
            if (not status):
                self.end_transaction()
                return internal_server_error(errormsg=res)
            self.end_transaction()
            data['name'] = res['rows'][0]['name']
        else:
            sql = render_template('/'.join([self.template_path, 'get_oid.sql']), tid=tid, name=data['name'])
            (status, res) = self.conn.execute_dict(sql)
            if (not status):
                self.end_transaction()
                return internal_server_error(errormsg=res)
        if (('convalidated' in res['rows'][0]) and res['rows'][0]['convalidated']):
            icon = 'icon-check_constraints_bad'
            valid = False
        else:
            icon = 'icon-check_constraints'
            valid = True
        return jsonify(node=self.blueprint.generate_browser_node(res['rows'][0]['oid'], tid, data['name'], icon=icon, valid=valid))
    except Exception as e:
        self.end_transaction()
        return make_json_response(status=400, success=0, errormsg=e)
This function will create a primary key.

Args:
  gid: Server Group ID
  sid: Server ID
  did: Database ID
  scid: Schema ID
  tid: Table ID
  cid: Check constraint ID

Returns:
@check_precondition
def create(self, gid, sid, did, scid, tid, cid=None):
    '\n        This function will create a primary key.\n\n        Args:\n          gid: Server Group ID\n          sid: Server ID\n          did: Database ID\n          scid: Schema ID\n          tid: Table ID\n          cid: Check constraint ID\n\n        Returns:\n\n        '
    required_args = ['consrc']
    data = (request.form if request.form else json.loads(request.data, encoding='utf-8'))
    for (k, v) in data.items():
        try:
            data[k] = json.loads(v, encoding='utf-8')
        except (ValueError, TypeError, KeyError):
            data[k] = v
    for arg in required_args:
        if ((arg not in data) or (data[arg] == )):
            return make_json_response(status=400, success=0, errormsg=_(('Could not find the required parameter (%s).' % arg)))
    data['schema'] = self.schema
    data['table'] = self.table
    try:
        if (('name' not in data) or (data['name'] == )):
            SQL = 'BEGIN;'
            (status, res) = self.conn.execute_scalar(SQL)
            if (not status):
                self.end_transaction()
                return internal_server_error(errormsg=res)
        SQL = render_template('/'.join([self.template_path, 'create.sql']), data=data)
        (status, msg) = self.conn.execute_scalar(SQL)
        if (not status):
            self.end_transaction()
            return internal_server_error(errormsg=msg)
        if (('name' not in data) or (data['name'] == )):
            sql = render_template('/'.join([self.template_path, 'get_oid_with_transaction.sql']), tid=tid)
            (status, res) = self.conn.execute_dict(sql)
            if (not status):
                self.end_transaction()
                return internal_server_error(errormsg=res)
            self.end_transaction()
            data['name'] = res['rows'][0]['name']
        else:
            sql = render_template('/'.join([self.template_path, 'get_oid.sql']), tid=tid, name=data['name'])
            (status, res) = self.conn.execute_dict(sql)
            if (not status):
                self.end_transaction()
                return internal_server_error(errormsg=res)
        if (('convalidated' in res['rows'][0]) and res['rows'][0]['convalidated']):
            icon = 'icon-check_constraints_bad'
            valid = False
        else:
            icon = 'icon-check_constraints'
            valid = True
        return jsonify(node=self.blueprint.generate_browser_node(res['rows'][0]['oid'], tid, data['name'], icon=icon, valid=valid))
    except Exception as e:
        self.end_transaction()
        return make_json_response(status=400, success=0, errormsg=e)