def delete_dataset_configuration(dataset_id):
    with db, db.cursor() as cur:
        query = querybuilder.delete('dataset')
        cur.execute(query, dict(id=dataset_id))

    current_app.plugins.call_hook('dataset_delete', dataset_id)

    return '', 200
def delete_dataset_configuration(dataset_id):
    with db, db.cursor() as cur:
        query = querybuilder.delete("dataset")
        cur.execute(query, dict(id=dataset_id))

    current_app.plugins.call_hook("dataset_delete", dataset_id)

    return "", 200
    def resource_data_remove(self, objid):
        # We need the OID to remove the lobject
        original = self.resource_data_get_info(objid)

        with self.db, self.db.cursor() as cur:
            lobject = db.lobject(oid=resource['data_oid'], mode='rb')
            data = lobject.read()
            lobject.close()

            cur.execute(querybuilder.delete('resource_data'), {'id': objid})
Exemple #4
0
    def resource_data_remove(self, objid):
        # We need the OID to remove the lobject
        original = self.resource_data_get_info(objid)

        with self.db, self.db.cursor() as cur:
            lobject = db.lobject(oid=resource['data_oid'], mode='rb')
            data = lobject.read()
            lobject.close()

            cur.execute(querybuilder.delete('resource_data'), {'id': objid})
Exemple #5
0
def test_querybuilder_delete():
    query = querybuilder.delete('mytable')
    assert query == 'DELETE FROM "mytable" WHERE "id"=%(id)s'

    query = querybuilder.delete('mytable', table_key='my_id')
    assert query == 'DELETE FROM "mytable" WHERE "my_id"=%(my_id)s'

    with pytest.raises(ValueError):
        querybuilder.delete('Invalid table name')

    with pytest.raises(ValueError):
        querybuilder.delete('mytable', table_key='invalid field')
def delete_resource_data(resource_id):
    with db.cursor() as cur:
        cur.execute(
            """
        SELECT id, data_oid FROM "resource" WHERE id = %(id)s;
        """, dict(id=resource_id))
        resource = cur.fetchone()

    # todo: better use a streaming response here..?
    with db:
        lobj = db.lobject(oid=resource['data_oid'], mode='wb')
        lobj.unlink()

    # Then, create a record for the metadata
    with db, db.cursor() as cur:
        query = querybuilder.delete('resource')
        cur.execute(query, dict(id=resource_id))

    db.commit()
    return '', 200
def delete_resource_data(resource_id):
    with db.cursor() as cur:
        cur.execute(
            """
        SELECT id, data_oid FROM "resource" WHERE id = %(id)s;
        """,
            dict(id=resource_id),
        )
        resource = cur.fetchone()

    # todo: better use a streaming response here..?
    with db:
        lobj = db.lobject(oid=resource["data_oid"], mode="wb")
        lobj.unlink()

    # Then, create a record for the metadata
    with db, db.cursor() as cur:
        query = querybuilder.delete("resource")
        cur.execute(query, dict(id=resource_id))

    db.commit()
    return "", 200
 def _dsres_delete(self, name, obj_id):
     query = querybuilder.delete(name)
     with self.db, self.db.cursor() as cur:
         cur.execute(query, dict(id=obj_id))
Exemple #9
0
 def _dsres_delete(self, name, obj_id):
     query = querybuilder.delete(name)
     with self.db, self.db.cursor() as cur:
         cur.execute(query, dict(id=obj_id))