""" Service MG/sources/calls/delete to delete the foreing table. """ from tools.layer import Layer from tools import const def post(task, user=None, input_layer: Layer = None): """ Delete the foreing table Parameters ---------- user: str User ID input_layer : Layer Object Input Layer Returns ------- dict Dict with status and message Examples -------- >>> import requests >>> input_layer = {'protocol': 'PostgreSQL', ... 'type': 'VECTOR', ... 'driver_type': 'PostgreSQL', ... 'ip': '192.168.1.43', ... "domain": '', ... 'port': '30030', ... 'user': 'srm_postgres_1', ... 'password': 'pg_produccion#1', ... 'database_name': 'imetadata', ... 'schema': 'TEST', ... 'table_view_name': 'edificios'} >>> parameters={'user':'TEST', "input_layer":input_layer} >>> response = requests.post(':/MG/sources/calls/delete', ... json=parameters) >>> response.json() {'task_id': 'XoiRl9'} """ response = input_layer.remove(input_layer) if response: obj = {'status': 'ok', 'message': 'Source successfully removed'} else: obj = {'status': 'Error', 'message': 'It was not possible to remove this source'} return obj POST_REQUEST = { 'function': post, 'parser': const.PARSER_NONCLEAR }