diff --git a/.jupyter/test.ipynb b/.jupyter/test.ipynb index 70b2c3573649bf6e57347b8a3834c3a0fb5952f4..28029f957a063336085233d6d7990431eadc7660 100644 --- a/.jupyter/test.ipynb +++ b/.jupyter/test.ipynb @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 99, "metadata": { "pycharm": { "name": "#%%\n" @@ -64,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 100, "metadata": { "pycharm": { "name": "#%%\n" @@ -115,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 101, "outputs": [], "source": [ "response = authentication.authenticate_user1({\n", @@ -154,13 +154,13 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 102, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'created': datetime.datetime(2022, 7, 23, 10, 36, 8, 105000, tzinfo=tzutc()),\n", + "{'created': datetime.datetime(2022, 7, 23, 11, 31, 39, 906000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -172,11 +172,11 @@ " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", - " 'hash': '0bb51761983c2adadc995d95a8ae2a1ae8ba5e9c18c05ad2631189f40eef194b',\n", + " 'hash': 'afa5b9a1ef1d07f09a90f6c76c696974a194376b5d3bae48e3a442056dc30ce2',\n", " 'id': 1,\n", - " 'internal_name': 'fda-userdb-airquality-429d627e-0a73-11ed-95b6-4f6e5b6c5022',\n", + " 'internal_name': 'fda-userdb-airquality-0468fb50-0a7b-11ed-95b6-4f6e5b6c5022',\n", " 'is_public': None,\n", - " 'name': 'Airquality 429d627e-0a73-11ed-95b6-4f6e5b6c5022'}\n" + " 'name': 'Airquality 0468fb50-0a7b-11ed-95b6-4f6e5b6c5022'}\n" ] } ], @@ -210,13 +210,13 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 103, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'created': datetime.datetime(2022, 7, 23, 10, 36, 8, 105000, tzinfo=tzutc()),\n", + "{'created': datetime.datetime(2022, 7, 23, 11, 31, 39, 906000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -228,11 +228,11 @@ " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", - " 'hash': '0bb51761983c2adadc995d95a8ae2a1ae8ba5e9c18c05ad2631189f40eef194b',\n", + " 'hash': 'afa5b9a1ef1d07f09a90f6c76c696974a194376b5d3bae48e3a442056dc30ce2',\n", " 'id': 1,\n", - " 'internal_name': 'fda-userdb-airquality-429d627e-0a73-11ed-95b6-4f6e5b6c5022',\n", + " 'internal_name': 'fda-userdb-airquality-0468fb50-0a7b-11ed-95b6-4f6e5b6c5022',\n", " 'is_public': None,\n", - " 'name': 'Airquality 429d627e-0a73-11ed-95b6-4f6e5b6c5022'}\n" + " 'name': 'Airquality 0468fb50-0a7b-11ed-95b6-4f6e5b6c5022'}\n" ] } ], @@ -240,8 +240,8 @@ "response = container.modify({\n", " \"action\": \"start\"\n", "}, container_id)\n", - "print(response)\n", - "time.sleep(5)" + "time.sleep(5)\n", + "print(response)" ], "metadata": { "collapsed": false, @@ -264,13 +264,13 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 104, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'container': {'created': datetime.datetime(2022, 7, 23, 10, 36, 8, 105000, tzinfo=tzutc()),\n", + "{'container': {'created': datetime.datetime(2022, 7, 23, 11, 31, 39, 906000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -282,12 +282,12 @@ " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", - " 'hash': '0bb51761983c2adadc995d95a8ae2a1ae8ba5e9c18c05ad2631189f40eef194b',\n", + " 'hash': 'afa5b9a1ef1d07f09a90f6c76c696974a194376b5d3bae48e3a442056dc30ce2',\n", " 'id': 1,\n", - " 'internal_name': 'fda-userdb-airquality-429d627e-0a73-11ed-95b6-4f6e5b6c5022',\n", + " 'internal_name': 'fda-userdb-airquality-0468fb50-0a7b-11ed-95b6-4f6e5b6c5022',\n", " 'is_public': None,\n", - " 'name': 'Airquality 429d627e-0a73-11ed-95b6-4f6e5b6c5022'},\n", - " 'created': datetime.datetime(2022, 7, 23, 10, 36, 14, 568000, tzinfo=tzutc()),\n", + " 'name': 'Airquality 0468fb50-0a7b-11ed-95b6-4f6e5b6c5022'},\n", + " 'created': datetime.datetime(2022, 7, 23, 11, 31, 57, 23000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -303,7 +303,7 @@ " 'engine': 'mariadb:10.5',\n", " 'id': 1,\n", " 'is_public': True,\n", - " 'name': 'Airquality 466a3472-0a73-11ed-95b6-4f6e5b6c5022'}\n" + " 'name': 'Airquality 0e9a48ae-0a7b-11ed-95b6-4f6e5b6c5022'}\n" ] } ], @@ -337,25 +337,25 @@ }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 105, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'contact': None,\n", - " 'container': {'created': datetime.datetime(2022, 7, 23, 10, 36, 8, 105000, tzinfo=tzutc()),\n", + " 'container': {'created': datetime.datetime(2022, 7, 23, 11, 31, 39, 906000, tzinfo=tzutc()),\n", " 'databases': None,\n", - " 'hash': '0bb51761983c2adadc995d95a8ae2a1ae8ba5e9c18c05ad2631189f40eef194b',\n", + " 'hash': 'afa5b9a1ef1d07f09a90f6c76c696974a194376b5d3bae48e3a442056dc30ce2',\n", " 'id': 1,\n", " 'image': {'id': 1, 'repository': 'mariadb', 'tag': '10.5'},\n", - " 'internal_name': 'fda-userdb-airquality-429d627e-0a73-11ed-95b6-4f6e5b6c5022',\n", + " 'internal_name': 'fda-userdb-airquality-0468fb50-0a7b-11ed-95b6-4f6e5b6c5022',\n", " 'ip_address': None,\n", " 'is_public': None,\n", - " 'name': 'Airquality 429d627e-0a73-11ed-95b6-4f6e5b6c5022',\n", - " 'port': 35971,\n", + " 'name': 'Airquality 0468fb50-0a7b-11ed-95b6-4f6e5b6c5022',\n", + " 'port': 62344,\n", " 'state': None},\n", - " 'created': datetime.datetime(2022, 7, 23, 10, 36, 14, 568000, tzinfo=tzutc()),\n", + " 'created': datetime.datetime(2022, 7, 23, 11, 31, 57, 23000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'containers': None,\n", @@ -372,52 +372,52 @@ " 'username': 'user'},\n", " 'deleted': None,\n", " 'description': 'Hourly measurements in Zürich, Switzerland',\n", - " 'exchange': 'airquality_466a3472-0a73-11ed-95b6-4f6e5b6c5022',\n", + " 'exchange': 'airquality_0e9a48ae-0a7b-11ed-95b6-4f6e5b6c5022',\n", " 'id': 1,\n", " 'image': {'compiled': None,\n", - " 'date_formats': [{'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 33000, tzinfo=tzutc()),\n", + " 'date_formats': [{'created_at': datetime.datetime(2022, 7, 23, 11, 29, 50, 206000, tzinfo=tzutc()),\n", " 'database_format': '%Y-%c-%d',\n", " 'example': '2022-01-30',\n", " 'has_time': False,\n", " 'id': 1,\n", " 'unix_format': 'yyyy-MM-dd'},\n", - " {'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 43000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 23, 11, 29, 50, 215000, tzinfo=tzutc()),\n", " 'database_format': '%d.%c.%Y',\n", " 'example': '30.01.2022',\n", " 'has_time': False,\n", " 'id': 2,\n", " 'unix_format': 'yyyy-MM-dd'},\n", - " {'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 46000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 23, 11, 29, 50, 220000, tzinfo=tzutc()),\n", " 'database_format': '%d.%c.%y',\n", " 'example': '30.01.22',\n", " 'has_time': False,\n", " 'id': 3,\n", " 'unix_format': 'yyyy-MM-dd'},\n", - " {'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 50000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 23, 11, 29, 50, 224000, tzinfo=tzutc()),\n", " 'database_format': '%c/%d/%Y',\n", " 'example': '01/30/2022',\n", " 'has_time': False,\n", " 'id': 4,\n", " 'unix_format': 'yyyy-MM-dd'},\n", - " {'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 55000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 23, 11, 29, 50, 228000, tzinfo=tzutc()),\n", " 'database_format': '%c/%d/%y',\n", " 'example': '01/30/22',\n", " 'has_time': False,\n", " 'id': 5,\n", " 'unix_format': 'yyyy-MM-dd'},\n", - " {'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 59000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 23, 11, 29, 50, 231000, tzinfo=tzutc()),\n", " 'database_format': '%Y-%c-%d %H:%i:%S.%f',\n", " 'example': '2022-01-30 13:44:25.0',\n", " 'has_time': True,\n", " 'id': 6,\n", " 'unix_format': 'yyyy-MM-dd HH:mm:ss.SSSSSS'},\n", - " {'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 63000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 23, 11, 29, 50, 234000, tzinfo=tzutc()),\n", " 'database_format': '%Y-%c-%d %H:%i:%S',\n", " 'example': '2022-01-30 13:44:25',\n", " 'has_time': True,\n", " 'id': 7,\n", " 'unix_format': 'yyyy-MM-dd HH:mm:ss'},\n", - " {'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 67000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 23, 11, 29, 50, 237000, tzinfo=tzutc()),\n", " 'database_format': '%d.%c.%Y %H:%i:%S',\n", " 'example': '30.01.2022 13:44:25',\n", " 'has_time': True,\n", @@ -448,11 +448,11 @@ " 'repository': 'mariadb',\n", " 'size': None,\n", " 'tag': '10.5'},\n", - " 'internal_name': 'airquality_466a3472-0a73-11ed-95b6-4f6e5b6c5022',\n", + " 'internal_name': 'airquality_0e9a48ae-0a7b-11ed-95b6-4f6e5b6c5022',\n", " 'is_public': True,\n", " 'language': None,\n", " 'license': None,\n", - " 'name': 'Airquality 466a3472-0a73-11ed-95b6-4f6e5b6c5022',\n", + " 'name': 'Airquality 0e9a48ae-0a7b-11ed-95b6-4f6e5b6c5022',\n", " 'publication': None,\n", " 'publisher': None,\n", " 'subjects': [],\n", @@ -486,13 +486,13 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 106, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'container': {'created': datetime.datetime(2022, 7, 23, 10, 36, 8, 105000, tzinfo=tzutc()),\n", + "{'container': {'created': datetime.datetime(2022, 7, 23, 11, 31, 39, 906000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -504,12 +504,12 @@ " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", - " 'hash': '0bb51761983c2adadc995d95a8ae2a1ae8ba5e9c18c05ad2631189f40eef194b',\n", + " 'hash': 'afa5b9a1ef1d07f09a90f6c76c696974a194376b5d3bae48e3a442056dc30ce2',\n", " 'id': 1,\n", - " 'internal_name': 'fda-userdb-airquality-429d627e-0a73-11ed-95b6-4f6e5b6c5022',\n", + " 'internal_name': 'fda-userdb-airquality-0468fb50-0a7b-11ed-95b6-4f6e5b6c5022',\n", " 'is_public': None,\n", - " 'name': 'Airquality 429d627e-0a73-11ed-95b6-4f6e5b6c5022'},\n", - " 'created': datetime.datetime(2022, 7, 23, 10, 36, 14, 568000, tzinfo=tzutc()),\n", + " 'name': 'Airquality 0468fb50-0a7b-11ed-95b6-4f6e5b6c5022'},\n", + " 'created': datetime.datetime(2022, 7, 23, 11, 31, 57, 23000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -534,7 +534,7 @@ " 'engine': 'mariadb:10.5',\n", " 'id': 1,\n", " 'is_public': True,\n", - " 'name': 'Airquality 466a3472-0a73-11ed-95b6-4f6e5b6c5022'}\n" + " 'name': 'Airquality 0e9a48ae-0a7b-11ed-95b6-4f6e5b6c5022'}\n" ] } ], @@ -573,7 +573,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 94, "outputs": [ { "name": "stdout", @@ -591,8 +591,8 @@ " 'titles_before': None,\n", " 'username': 'user'},\n", " 'id': 1,\n", - " 'internal_name': 'airquality_466a3473-0a73-11ed-95b6-4f6e5b6c5022',\n", - " 'name': 'Airquality 466a3473-0a73-11ed-95b6-4f6e5b6c5022'}\n" + " 'internal_name': 'airquality_eaf435b0-0a78-11ed-95b6-4f6e5b6c5022',\n", + " 'name': 'Airquality eaf435b0-0a78-11ed-95b6-4f6e5b6c5022'}\n" ] } ], @@ -669,7 +669,7 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 95, "outputs": [ { "name": "stdout", @@ -695,7 +695,7 @@ " 'check_expression': None,\n", " 'column_concept': None,\n", " 'column_type': 'date',\n", - " 'date_format': {'created_at': datetime.datetime(2022, 7, 23, 10, 35, 9, 33000, tzinfo=tzutc()),\n", + " 'date_format': {'created_at': datetime.datetime(2022, 7, 23, 11, 15, 16, 385000, tzinfo=tzutc()),\n", " 'database_format': '%Y-%c-%d',\n", " 'example': '2022-01-30',\n", " 'has_time': False,\n", @@ -808,12 +808,12 @@ " 'name': 'Status',\n", " 'references': None,\n", " 'unique': False}],\n", - " 'created': datetime.datetime(2022, 7, 23, 10, 36, 16, 462000, tzinfo=tzutc()),\n", + " 'created': datetime.datetime(2022, 7, 23, 11, 16, 38, 656000, tzinfo=tzutc()),\n", " 'description': 'Airquality in Zürich, Switzerland',\n", " 'id': 1,\n", - " 'internal_name': 'airquality_466a3473-0a73-11ed-95b6-4f6e5b6c5022',\n", - " 'name': 'Airquality 466a3473-0a73-11ed-95b6-4f6e5b6c5022',\n", - " 'topic': 'airquality_466a3473-0a73-11ed-95b6-4f6e5b6c5022'}\n" + " 'internal_name': 'airquality_eaf435b0-0a78-11ed-95b6-4f6e5b6c5022',\n", + " 'name': 'Airquality eaf435b0-0a78-11ed-95b6-4f6e5b6c5022',\n", + " 'topic': 'airquality_eaf435b0-0a78-11ed-95b6-4f6e5b6c5022'}\n" ] } ], @@ -844,7 +844,7 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 96, "outputs": [ { "name": "stdout", @@ -885,13 +885,13 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 97, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'id': 6,\n", + "{'id': 1,\n", " 'result': [{'Date': '2021-01-01T00:00:00Z',\n", " 'Interval': 'h1',\n", " 'Location': 'Schimmelstrasse',\n", @@ -945,16 +945,16 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 98, "outputs": [ { "ename": "ApiException", - "evalue": "(400)\nReason: Bad Request\nHTTP response headers: HTTPHeaderDict({'transfer-encoding': 'chunked', 'Vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json', 'Date': 'Sat, 23 Jul 2022 10:53:23 GMT'})\nHTTP response body: b'{\"status\":\"BAD_REQUEST\",\"message\":\"Query not valid for this database\",\"code\":\"error.query.malformed\"}'\n", + "evalue": "(400)\nReason: Bad Request\nHTTP response headers: HTTPHeaderDict({'transfer-encoding': 'chunked', 'Vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json', 'Date': 'Sat, 23 Jul 2022 11:16:44 GMT'})\nHTTP response body: b'{\"status\":\"BAD_REQUEST\",\"message\":\"Query not valid for this database\",\"code\":\"error.query.malformed\"}'\n", "output_type": "error", "traceback": [ "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", "\u001B[0;31mApiException\u001B[0m Traceback (most recent call last)", - "Input \u001B[0;32mIn [85]\u001B[0m, in \u001B[0;36m<cell line: 1>\u001B[0;34m()\u001B[0m\n\u001B[0;32m----> 1\u001B[0m response \u001B[38;5;241m=\u001B[39m \u001B[43mquery\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43m{\u001B[49m\n\u001B[1;32m 2\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mstatement\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m:\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mselect `date`, `location`, `parameter`, `interval`, `unit`, `value`, `status` from `\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m \u001B[49m\u001B[38;5;241;43m+\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mtable_internal_name\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m+\u001B[39;49m\u001B[43m \u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43m` where `foo` = \u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mbar\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\n\u001B[1;32m 3\u001B[0m \u001B[43m}\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontainer_id\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mdatabase_id\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mpage\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;241;43m0\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43msize\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;241;43m3\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[1;32m 4\u001B[0m \u001B[38;5;28mprint\u001B[39m(response)\n", + "Input \u001B[0;32mIn [98]\u001B[0m, in \u001B[0;36m<cell line: 1>\u001B[0;34m()\u001B[0m\n\u001B[0;32m----> 1\u001B[0m response \u001B[38;5;241m=\u001B[39m \u001B[43mquery\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mexecute\u001B[49m\u001B[43m(\u001B[49m\u001B[43m{\u001B[49m\n\u001B[1;32m 2\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mstatement\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m:\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mselect `date`, `location`, `parameter`, `interval`, `unit`, `value`, `status` from `\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m \u001B[49m\u001B[38;5;241;43m+\u001B[39;49m\u001B[43m \u001B[49m\u001B[43mtable_internal_name\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m+\u001B[39;49m\u001B[43m \u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43m` where `foo` = \u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mbar\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\n\u001B[1;32m 3\u001B[0m \u001B[43m}\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontainer_id\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mdatabase_id\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mpage\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;241;43m0\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43msize\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;241;43m3\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[1;32m 4\u001B[0m \u001B[38;5;28mprint\u001B[39m(response)\n", "File \u001B[0;32m~/Projects/fda-services/.jupyter/api_query/api/query_endpoint_api.py:57\u001B[0m, in \u001B[0;36mQueryEndpointApi.execute\u001B[0;34m(self, body, id, database_id, **kwargs)\u001B[0m\n\u001B[1;32m 55\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mexecute_with_http_info(body, \u001B[38;5;28mid\u001B[39m, database_id, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mkwargs) \u001B[38;5;66;03m# noqa: E501\u001B[39;00m\n\u001B[1;32m 56\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[0;32m---> 57\u001B[0m (data) \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mexecute_with_http_info\u001B[49m\u001B[43m(\u001B[49m\u001B[43mbody\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mid\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mdatabase_id\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mkwargs\u001B[49m\u001B[43m)\u001B[49m \u001B[38;5;66;03m# noqa: E501\u001B[39;00m\n\u001B[1;32m 58\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m data\n", "File \u001B[0;32m~/Projects/fda-services/.jupyter/api_query/api/query_endpoint_api.py:140\u001B[0m, in \u001B[0;36mQueryEndpointApi.execute_with_http_info\u001B[0;34m(self, body, id, database_id, **kwargs)\u001B[0m\n\u001B[1;32m 137\u001B[0m \u001B[38;5;66;03m# Authentication setting\u001B[39;00m\n\u001B[1;32m 138\u001B[0m auth_settings \u001B[38;5;241m=\u001B[39m [\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mbearerAuth\u001B[39m\u001B[38;5;124m'\u001B[39m] \u001B[38;5;66;03m# noqa: E501\u001B[39;00m\n\u001B[0;32m--> 140\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mapi_client\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mcall_api\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 141\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43m/api/container/\u001B[39;49m\u001B[38;5;132;43;01m{id}\u001B[39;49;00m\u001B[38;5;124;43m/database/\u001B[39;49m\u001B[38;5;132;43;01m{databaseId}\u001B[39;49;00m\u001B[38;5;124;43m/query\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mPUT\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m,\u001B[49m\n\u001B[1;32m 142\u001B[0m \u001B[43m \u001B[49m\u001B[43mpath_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 143\u001B[0m \u001B[43m \u001B[49m\u001B[43mquery_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 144\u001B[0m \u001B[43m \u001B[49m\u001B[43mheader_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 145\u001B[0m \u001B[43m \u001B[49m\u001B[43mbody\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mbody_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 146\u001B[0m \u001B[43m \u001B[49m\u001B[43mpost_params\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mform_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 147\u001B[0m \u001B[43m \u001B[49m\u001B[43mfiles\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mlocal_var_files\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 148\u001B[0m \u001B[43m \u001B[49m\u001B[43mresponse_type\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mQueryResultDto\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;66;43;03m# noqa: E501\u001B[39;49;00m\n\u001B[1;32m 149\u001B[0m \u001B[43m \u001B[49m\u001B[43mauth_settings\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mauth_settings\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 150\u001B[0m \u001B[43m \u001B[49m\u001B[43masync_req\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mparams\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43masync_req\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 151\u001B[0m \u001B[43m \u001B[49m\u001B[43m_return_http_data_only\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mparams\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43m_return_http_data_only\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 152\u001B[0m \u001B[43m \u001B[49m\u001B[43m_preload_content\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mparams\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43m_preload_content\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 153\u001B[0m \u001B[43m \u001B[49m\u001B[43m_request_timeout\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mparams\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43m_request_timeout\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 154\u001B[0m \u001B[43m \u001B[49m\u001B[43mcollection_formats\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mcollection_formats\u001B[49m\u001B[43m)\u001B[49m\n", "File \u001B[0;32m~/Projects/fda-services/.jupyter/api_query/api_client.py:316\u001B[0m, in \u001B[0;36mApiClient.call_api\u001B[0;34m(self, resource_path, method, path_params, query_params, header_params, body, post_params, files, response_type, auth_settings, async_req, _return_http_data_only, collection_formats, _preload_content, _request_timeout)\u001B[0m\n\u001B[1;32m 279\u001B[0m \u001B[38;5;124;03m\"\"\"Makes the HTTP request (synchronous) and returns deserialized data.\u001B[39;00m\n\u001B[1;32m 280\u001B[0m \n\u001B[1;32m 281\u001B[0m \u001B[38;5;124;03mTo make an async request, set the async_req parameter.\u001B[39;00m\n\u001B[0;32m (...)\u001B[0m\n\u001B[1;32m 313\u001B[0m \u001B[38;5;124;03m then the method will return the response directly.\u001B[39;00m\n\u001B[1;32m 314\u001B[0m \u001B[38;5;124;03m\"\"\"\u001B[39;00m\n\u001B[1;32m 315\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m async_req:\n\u001B[0;32m--> 316\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m__call_api\u001B[49m\u001B[43m(\u001B[49m\u001B[43mresource_path\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mmethod\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 317\u001B[0m \u001B[43m \u001B[49m\u001B[43mpath_params\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mquery_params\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mheader_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 318\u001B[0m \u001B[43m \u001B[49m\u001B[43mbody\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mpost_params\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mfiles\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 319\u001B[0m \u001B[43m \u001B[49m\u001B[43mresponse_type\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mauth_settings\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 320\u001B[0m \u001B[43m \u001B[49m\u001B[43m_return_http_data_only\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcollection_formats\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 321\u001B[0m \u001B[43m \u001B[49m\u001B[43m_preload_content\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m_request_timeout\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 322\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[1;32m 323\u001B[0m thread \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mpool\u001B[38;5;241m.\u001B[39mapply_async(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m__call_api, (resource_path,\n\u001B[1;32m 324\u001B[0m method, path_params, query_params,\n\u001B[1;32m 325\u001B[0m header_params, body,\n\u001B[0;32m (...)\u001B[0m\n\u001B[1;32m 329\u001B[0m collection_formats,\n\u001B[1;32m 330\u001B[0m _preload_content, _request_timeout))\n", @@ -962,7 +962,7 @@ "File \u001B[0;32m~/Projects/fda-services/.jupyter/api_query/api_client.py:366\u001B[0m, in \u001B[0;36mApiClient.request\u001B[0;34m(self, method, url, query_params, headers, post_params, body, _preload_content, _request_timeout)\u001B[0m\n\u001B[1;32m 358\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mrest_client\u001B[38;5;241m.\u001B[39mPOST(url,\n\u001B[1;32m 359\u001B[0m query_params\u001B[38;5;241m=\u001B[39mquery_params,\n\u001B[1;32m 360\u001B[0m headers\u001B[38;5;241m=\u001B[39mheaders,\n\u001B[0;32m (...)\u001B[0m\n\u001B[1;32m 363\u001B[0m _request_timeout\u001B[38;5;241m=\u001B[39m_request_timeout,\n\u001B[1;32m 364\u001B[0m body\u001B[38;5;241m=\u001B[39mbody)\n\u001B[1;32m 365\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m method \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mPUT\u001B[39m\u001B[38;5;124m\"\u001B[39m:\n\u001B[0;32m--> 366\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mrest_client\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mPUT\u001B[49m\u001B[43m(\u001B[49m\u001B[43murl\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 367\u001B[0m \u001B[43m \u001B[49m\u001B[43mquery_params\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mquery_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 368\u001B[0m \u001B[43m \u001B[49m\u001B[43mheaders\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mheaders\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 369\u001B[0m \u001B[43m \u001B[49m\u001B[43mpost_params\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mpost_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 370\u001B[0m \u001B[43m \u001B[49m\u001B[43m_preload_content\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43m_preload_content\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 371\u001B[0m \u001B[43m \u001B[49m\u001B[43m_request_timeout\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43m_request_timeout\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 372\u001B[0m \u001B[43m \u001B[49m\u001B[43mbody\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mbody\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 373\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m method \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mPATCH\u001B[39m\u001B[38;5;124m\"\u001B[39m:\n\u001B[1;32m 374\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mrest_client\u001B[38;5;241m.\u001B[39mPATCH(url,\n\u001B[1;32m 375\u001B[0m query_params\u001B[38;5;241m=\u001B[39mquery_params,\n\u001B[1;32m 376\u001B[0m headers\u001B[38;5;241m=\u001B[39mheaders,\n\u001B[0;32m (...)\u001B[0m\n\u001B[1;32m 379\u001B[0m _request_timeout\u001B[38;5;241m=\u001B[39m_request_timeout,\n\u001B[1;32m 380\u001B[0m body\u001B[38;5;241m=\u001B[39mbody)\n", "File \u001B[0;32m~/Projects/fda-services/.jupyter/api_query/rest.py:273\u001B[0m, in \u001B[0;36mRESTClientObject.PUT\u001B[0;34m(self, url, headers, query_params, post_params, body, _preload_content, _request_timeout)\u001B[0m\n\u001B[1;32m 271\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mPUT\u001B[39m(\u001B[38;5;28mself\u001B[39m, url, headers\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mNone\u001B[39;00m, query_params\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mNone\u001B[39;00m, post_params\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mNone\u001B[39;00m,\n\u001B[1;32m 272\u001B[0m body\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mNone\u001B[39;00m, _preload_content\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m, _request_timeout\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mNone\u001B[39;00m):\n\u001B[0;32m--> 273\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mrequest\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mPUT\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43murl\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 274\u001B[0m \u001B[43m \u001B[49m\u001B[43mheaders\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mheaders\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 275\u001B[0m \u001B[43m \u001B[49m\u001B[43mquery_params\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mquery_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 276\u001B[0m \u001B[43m \u001B[49m\u001B[43mpost_params\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mpost_params\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 277\u001B[0m \u001B[43m \u001B[49m\u001B[43m_preload_content\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43m_preload_content\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 278\u001B[0m \u001B[43m \u001B[49m\u001B[43m_request_timeout\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43m_request_timeout\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 279\u001B[0m \u001B[43m \u001B[49m\u001B[43mbody\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mbody\u001B[49m\u001B[43m)\u001B[49m\n", "File \u001B[0;32m~/Projects/fda-services/.jupyter/api_query/rest.py:222\u001B[0m, in \u001B[0;36mRESTClientObject.request\u001B[0;34m(self, method, url, query_params, headers, body, post_params, _preload_content, _request_timeout)\u001B[0m\n\u001B[1;32m 219\u001B[0m logger\u001B[38;5;241m.\u001B[39mdebug(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mresponse body: \u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[38;5;124m\"\u001B[39m, r\u001B[38;5;241m.\u001B[39mdata)\n\u001B[1;32m 221\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;241m200\u001B[39m \u001B[38;5;241m<\u001B[39m\u001B[38;5;241m=\u001B[39m r\u001B[38;5;241m.\u001B[39mstatus \u001B[38;5;241m<\u001B[39m\u001B[38;5;241m=\u001B[39m \u001B[38;5;241m299\u001B[39m:\n\u001B[0;32m--> 222\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m ApiException(http_resp\u001B[38;5;241m=\u001B[39mr)\n\u001B[1;32m 224\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m r\n", - "\u001B[0;31mApiException\u001B[0m: (400)\nReason: Bad Request\nHTTP response headers: HTTPHeaderDict({'transfer-encoding': 'chunked', 'Vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json', 'Date': 'Sat, 23 Jul 2022 10:53:23 GMT'})\nHTTP response body: b'{\"status\":\"BAD_REQUEST\",\"message\":\"Query not valid for this database\",\"code\":\"error.query.malformed\"}'\n" + "\u001B[0;31mApiException\u001B[0m: (400)\nReason: Bad Request\nHTTP response headers: HTTPHeaderDict({'transfer-encoding': 'chunked', 'Vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json', 'Date': 'Sat, 23 Jul 2022 11:16:44 GMT'})\nHTTP response body: b'{\"status\":\"BAD_REQUEST\",\"message\":\"Query not valid for this database\",\"code\":\"error.query.malformed\"}'\n" ] } ], diff --git a/fda-database-service/rest-service/src/main/java/at/tuwien/endpoints/ContainerDatabaseEndpoint.java b/fda-database-service/rest-service/src/main/java/at/tuwien/endpoints/ContainerDatabaseEndpoint.java index 31601a915fbd3afea94a8fa14be8ed6b12f4614f..2c57b444bb742964a40cbde0f1a7db93f5cb8e51 100644 --- a/fda-database-service/rest-service/src/main/java/at/tuwien/endpoints/ContainerDatabaseEndpoint.java +++ b/fda-database-service/rest-service/src/main/java/at/tuwien/endpoints/ContainerDatabaseEndpoint.java @@ -8,6 +8,7 @@ import at.tuwien.entities.database.Database; import at.tuwien.exception.*; import at.tuwien.mapper.DatabaseMapper; import at.tuwien.service.MessageQueueService; +import at.tuwien.service.QueryStoreService; import at.tuwien.service.impl.MariaDbServiceImpl; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.security.SecurityRequirement; @@ -33,13 +34,15 @@ public class ContainerDatabaseEndpoint { private final DatabaseMapper databaseMapper; private final MariaDbServiceImpl databaseService; + private final QueryStoreService queryStoreService; private final MessageQueueService messageQueueService; @Autowired public ContainerDatabaseEndpoint(DatabaseMapper databaseMapper, MariaDbServiceImpl databaseService, - MessageQueueService messageQueueService) { + QueryStoreService queryStoreService, MessageQueueService messageQueueService) { this.databaseMapper = databaseMapper; this.databaseService = databaseService; + this.queryStoreService = queryStoreService; this.messageQueueService = messageQueueService; } @@ -79,6 +82,7 @@ public class ContainerDatabaseEndpoint { DatabaseNotFoundException, DatabaseNameExistsException, DatabaseConnectionException { final Database database = databaseService.create(containerId, createDto, principal); messageQueueService.createExchange(database, principal); + queryStoreService.create(containerId, database.getId()); return ResponseEntity.status(HttpStatus.CREATED) .body(databaseMapper.databaseToDatabaseBriefDto(database)); } diff --git a/fda-database-service/rest-service/src/main/resources/querystore.sql b/fda-database-service/rest-service/src/main/resources/querystore.sql index 19f38a3d74a89764d183095adf7748ee81a9b94f..308c0531ea22cec2ea4556c4ee670d79d5b67631 100644 --- a/fda-database-service/rest-service/src/main/resources/querystore.sql +++ b/fda-database-service/rest-service/src/main/resources/querystore.sql @@ -1,7 +1,7 @@ -- SEQUENCES -CREATE SEQUENCE `qs_tables_seq`; -CREATE SEQUENCE `qs_columns_seq`; -CREATE SEQUENCE `qs_columns_seq`; +CREATE SEQUENCE IF NOT EXISTS `qs_queries_seq`; +CREATE SEQUENCE IF NOT EXISTS `qs_tables_seq`; +CREATE SEQUENCE IF NOT EXISTS `qs_columns_seq`; -- TABLES CREATE TABLE `qs_queries` diff --git a/fda-database-service/services/src/main/java/at/tuwien/service/QueryStoreService.java b/fda-database-service/services/src/main/java/at/tuwien/service/QueryStoreService.java new file mode 100644 index 0000000000000000000000000000000000000000..52196b30a91be60135c8ca0e02af4f25ca531505 --- /dev/null +++ b/fda-database-service/services/src/main/java/at/tuwien/service/QueryStoreService.java @@ -0,0 +1,9 @@ +package at.tuwien.service; + +import at.tuwien.exception.DatabaseConnectionException; +import at.tuwien.exception.DatabaseNotFoundException; + +public interface QueryStoreService { + + void create(Long containerId, Long databaseId) throws DatabaseNotFoundException, DatabaseConnectionException; +} diff --git a/fda-database-service/services/src/main/java/at/tuwien/service/impl/QueryStoreServiceImpl.java b/fda-database-service/services/src/main/java/at/tuwien/service/impl/QueryStoreServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3cceb88bc7366fd1003404797e7d6a98ca990d41 --- /dev/null +++ b/fda-database-service/services/src/main/java/at/tuwien/service/impl/QueryStoreServiceImpl.java @@ -0,0 +1,40 @@ +package at.tuwien.service.impl; + +import at.tuwien.entities.database.Database; +import at.tuwien.exception.DatabaseConnectionException; +import at.tuwien.exception.DatabaseNotFoundException; +import at.tuwien.service.DatabaseService; +import at.tuwien.service.QueryStoreService; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.sql.Connection; + +@Log4j2 +@Service +public class QueryStoreServiceImpl extends HibernateConnector implements QueryStoreService { + + private final DatabaseService databaseService; + + @Autowired + public QueryStoreServiceImpl(DatabaseService databaseService) { + this.databaseService = databaseService; + } + + @Override + public void create(Long containerId, Long databaseId) throws DatabaseNotFoundException, DatabaseConnectionException { + final Database database = databaseService.findById(containerId, databaseId); + /* create */ + final Connection connection = getConnection(database.getContainer().getImage(), database.getContainer(), database); + execute(connection, "CREATE SEQUENCE IF NOT EXISTS `qs_queries_seq`"); + execute(connection, "CREATE SEQUENCE IF NOT EXISTS `qs_tables_seq`"); + execute(connection, "CREATE SEQUENCE IF NOT EXISTS `qs_columns_seq`"); + execute(connection, "CREATE TABLE `qs_queries` (`id` bigint not null primary key default nextval(`qs_queries_seq`), `cid` bigint not null, `created` datetime not null, `created_by` bigint not null, `dbid` bigint not null, `execution` datetime not null, `last_modified` datetime not null, `query` text not null, `query_hash` varchar(255) not null, `result_hash` varchar(255), `result_number` bigint)"); + execute(connection, "CREATE TABLE `qs_tables` (`id` bigint not null primary key default nextval(`qs_tables_seq`), `created` datetime not null, `dbid` bigint not null, `last_modified` datetime)"); + execute(connection, "CREATE TABLE `qs_columns` (`id` bigint not null primary key default nextval(`qs_columns_seq`), `created` datetime not null, `dbid` bigint not null, `tid` bigint not null, `last_modified` datetime)"); + log.info("Created query store in database with id {}", databaseId); + log.debug("created query store in database {}", database); + } + +}