diff --git a/.jupyter/api_authentication/models/user_dto.py b/.jupyter/api_authentication/models/user_dto.py index 7558c863f9a9d37234f132fc7f5ecb9d986f0aac..aeaa5c73af87bc9be364275e5f0e22cb7a5fa0b5 100644 --- a/.jupyter/api_authentication/models/user_dto.py +++ b/.jupyter/api_authentication/models/user_dto.py @@ -41,6 +41,7 @@ class UserDto(object): 'email': 'str', 'titles_before': 'str', 'titles_after': 'str', + 'theme_dark': 'bool', 'email_verified': 'bool' } @@ -58,10 +59,11 @@ class UserDto(object): 'email': 'email', 'titles_before': 'titles_before', 'titles_after': 'titles_after', + 'theme_dark': 'theme_dark', 'email_verified': 'email_verified' } - def __init__(self, id=None, authorities=None, username=None, firstname=None, lastname=None, affiliation=None, orcid=None, containers=None, databases=None, identifiers=None, email=None, titles_before=None, titles_after=None, email_verified=None): # noqa: E501 + def __init__(self, id=None, authorities=None, username=None, firstname=None, lastname=None, affiliation=None, orcid=None, containers=None, databases=None, identifiers=None, email=None, titles_before=None, titles_after=None, theme_dark=None, email_verified=None): # noqa: E501 """UserDto - a model defined in Swagger""" # noqa: E501 self._id = None self._authorities = None @@ -76,6 +78,7 @@ class UserDto(object): self._email = None self._titles_before = None self._titles_after = None + self._theme_dark = None self._email_verified = None self.discriminator = None self.id = id @@ -101,6 +104,7 @@ class UserDto(object): self.titles_before = titles_before if titles_after is not None: self.titles_after = titles_after + self.theme_dark = theme_dark if email_verified is not None: self.email_verified = email_verified @@ -383,6 +387,29 @@ class UserDto(object): self._titles_after = titles_after + @property + def theme_dark(self): + """Gets the theme_dark of this UserDto. # noqa: E501 + + + :return: The theme_dark of this UserDto. # noqa: E501 + :rtype: bool + """ + return self._theme_dark + + @theme_dark.setter + def theme_dark(self, theme_dark): + """Sets the theme_dark of this UserDto. + + + :param theme_dark: The theme_dark of this UserDto. # noqa: E501 + :type: bool + """ + if theme_dark is None: + raise ValueError("Invalid value for `theme_dark`, must not be `None`") # noqa: E501 + + self._theme_dark = theme_dark + @property def email_verified(self): """Gets the email_verified of this UserDto. # noqa: E501 diff --git a/.jupyter/api_container/models/user_dto.py b/.jupyter/api_container/models/user_dto.py index 9cd62103d48862140f4732e047d101f090eaf612..a3713fa5231999159a5fbcbf8272fd68c9b19f83 100644 --- a/.jupyter/api_container/models/user_dto.py +++ b/.jupyter/api_container/models/user_dto.py @@ -41,6 +41,7 @@ class UserDto(object): 'email': 'str', 'titles_before': 'str', 'titles_after': 'str', + 'theme_dark': 'bool', 'email_verified': 'bool' } @@ -58,10 +59,11 @@ class UserDto(object): 'email': 'email', 'titles_before': 'titles_before', 'titles_after': 'titles_after', + 'theme_dark': 'theme_dark', 'email_verified': 'email_verified' } - def __init__(self, id=None, authorities=None, username=None, firstname=None, lastname=None, affiliation=None, orcid=None, containers=None, databases=None, identifiers=None, email=None, titles_before=None, titles_after=None, email_verified=None): # noqa: E501 + def __init__(self, id=None, authorities=None, username=None, firstname=None, lastname=None, affiliation=None, orcid=None, containers=None, databases=None, identifiers=None, email=None, titles_before=None, titles_after=None, theme_dark=None, email_verified=None): # noqa: E501 """UserDto - a model defined in Swagger""" # noqa: E501 self._id = None self._authorities = None @@ -76,6 +78,7 @@ class UserDto(object): self._email = None self._titles_before = None self._titles_after = None + self._theme_dark = None self._email_verified = None self.discriminator = None self.id = id @@ -101,6 +104,7 @@ class UserDto(object): self.titles_before = titles_before if titles_after is not None: self.titles_after = titles_after + self.theme_dark = theme_dark if email_verified is not None: self.email_verified = email_verified @@ -383,6 +387,29 @@ class UserDto(object): self._titles_after = titles_after + @property + def theme_dark(self): + """Gets the theme_dark of this UserDto. # noqa: E501 + + + :return: The theme_dark of this UserDto. # noqa: E501 + :rtype: bool + """ + return self._theme_dark + + @theme_dark.setter + def theme_dark(self, theme_dark): + """Sets the theme_dark of this UserDto. + + + :param theme_dark: The theme_dark of this UserDto. # noqa: E501 + :type: bool + """ + if theme_dark is None: + raise ValueError("Invalid value for `theme_dark`, must not be `None`") # noqa: E501 + + self._theme_dark = theme_dark + @property def email_verified(self): """Gets the email_verified of this UserDto. # noqa: E501 diff --git a/.jupyter/api_database/models/user_dto.py b/.jupyter/api_database/models/user_dto.py index df9cdbd3c0da20d0166aeb4babfd731d98a37cb0..949d9c1d04a775a94bc025bc38c66c30b323e35d 100644 --- a/.jupyter/api_database/models/user_dto.py +++ b/.jupyter/api_database/models/user_dto.py @@ -41,6 +41,7 @@ class UserDto(object): 'email': 'str', 'titles_before': 'str', 'titles_after': 'str', + 'theme_dark': 'bool', 'email_verified': 'bool' } @@ -58,10 +59,11 @@ class UserDto(object): 'email': 'email', 'titles_before': 'titles_before', 'titles_after': 'titles_after', + 'theme_dark': 'theme_dark', 'email_verified': 'email_verified' } - def __init__(self, id=None, authorities=None, username=None, firstname=None, lastname=None, affiliation=None, orcid=None, containers=None, databases=None, identifiers=None, email=None, titles_before=None, titles_after=None, email_verified=None): # noqa: E501 + def __init__(self, id=None, authorities=None, username=None, firstname=None, lastname=None, affiliation=None, orcid=None, containers=None, databases=None, identifiers=None, email=None, titles_before=None, titles_after=None, theme_dark=None, email_verified=None): # noqa: E501 """UserDto - a model defined in Swagger""" # noqa: E501 self._id = None self._authorities = None @@ -76,6 +78,7 @@ class UserDto(object): self._email = None self._titles_before = None self._titles_after = None + self._theme_dark = None self._email_verified = None self.discriminator = None self.id = id @@ -101,6 +104,7 @@ class UserDto(object): self.titles_before = titles_before if titles_after is not None: self.titles_after = titles_after + self.theme_dark = theme_dark if email_verified is not None: self.email_verified = email_verified @@ -383,6 +387,29 @@ class UserDto(object): self._titles_after = titles_after + @property + def theme_dark(self): + """Gets the theme_dark of this UserDto. # noqa: E501 + + + :return: The theme_dark of this UserDto. # noqa: E501 + :rtype: bool + """ + return self._theme_dark + + @theme_dark.setter + def theme_dark(self, theme_dark): + """Sets the theme_dark of this UserDto. + + + :param theme_dark: The theme_dark of this UserDto. # noqa: E501 + :type: bool + """ + if theme_dark is None: + raise ValueError("Invalid value for `theme_dark`, must not be `None`") # noqa: E501 + + self._theme_dark = theme_dark + @property def email_verified(self): """Gets the email_verified of this UserDto. # noqa: E501 diff --git a/.jupyter/api_query/models/user_dto.py b/.jupyter/api_query/models/user_dto.py index ed1462bfda2dd30a67ec1eb3cab8fdae0d3962a7..86827496d3dd009a28fd6f35faac7573b153922f 100644 --- a/.jupyter/api_query/models/user_dto.py +++ b/.jupyter/api_query/models/user_dto.py @@ -41,6 +41,7 @@ class UserDto(object): 'email': 'str', 'titles_before': 'str', 'titles_after': 'str', + 'theme_dark': 'bool', 'email_verified': 'bool' } @@ -58,10 +59,11 @@ class UserDto(object): 'email': 'email', 'titles_before': 'titles_before', 'titles_after': 'titles_after', + 'theme_dark': 'theme_dark', 'email_verified': 'email_verified' } - def __init__(self, id=None, authorities=None, username=None, firstname=None, lastname=None, affiliation=None, orcid=None, containers=None, databases=None, identifiers=None, email=None, titles_before=None, titles_after=None, email_verified=None): # noqa: E501 + def __init__(self, id=None, authorities=None, username=None, firstname=None, lastname=None, affiliation=None, orcid=None, containers=None, databases=None, identifiers=None, email=None, titles_before=None, titles_after=None, theme_dark=None, email_verified=None): # noqa: E501 """UserDto - a model defined in Swagger""" # noqa: E501 self._id = None self._authorities = None @@ -76,6 +78,7 @@ class UserDto(object): self._email = None self._titles_before = None self._titles_after = None + self._theme_dark = None self._email_verified = None self.discriminator = None self.id = id @@ -101,6 +104,7 @@ class UserDto(object): self.titles_before = titles_before if titles_after is not None: self.titles_after = titles_after + self.theme_dark = theme_dark if email_verified is not None: self.email_verified = email_verified @@ -383,6 +387,29 @@ class UserDto(object): self._titles_after = titles_after + @property + def theme_dark(self): + """Gets the theme_dark of this UserDto. # noqa: E501 + + + :return: The theme_dark of this UserDto. # noqa: E501 + :rtype: bool + """ + return self._theme_dark + + @theme_dark.setter + def theme_dark(self, theme_dark): + """Sets the theme_dark of this UserDto. + + + :param theme_dark: The theme_dark of this UserDto. # noqa: E501 + :type: bool + """ + if theme_dark is None: + raise ValueError("Invalid value for `theme_dark`, must not be `None`") # noqa: E501 + + self._theme_dark = theme_dark + @property def email_verified(self): """Gets the email_verified of this UserDto. # noqa: E501 diff --git a/.jupyter/test.ipynb b/.jupyter/test.ipynb index 4c089d963961a0f28569fa0705c94948ad7239d2..9f8f1f23c6fc913491ce07ee3421b9dc84b9f1c6 100644 --- a/.jupyter/test.ipynb +++ b/.jupyter/test.ipynb @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 118, + "execution_count": 38, "metadata": { "pycharm": { "name": "#%%\n" @@ -64,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 39, "metadata": { "pycharm": { "name": "#%%\n" @@ -86,6 +86,7 @@ " 'identifiers': None,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'}\n" @@ -115,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 120, + "execution_count": 40, "outputs": [], "source": [ "response = authentication.authenticate_user1({\n", @@ -154,13 +155,13 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 41, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'created': datetime.datetime(2022, 7, 25, 15, 15, 12, 611000, tzinfo=tzutc()),\n", + "{'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -169,20 +170,21 @@ " 'id': 2,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", - " 'hash': 'eb62216417341804986f04e6a5c06e2983b16188632d4a3332df6d4166105026',\n", + " 'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',\n", " 'id': 1,\n", - " 'internal_name': 'fda-userdb-airquality-93f209d0-0c2c-11ed-8e19-276c36d4e620',\n", + " 'internal_name': 'fda-userdb-airquality',\n", " 'is_public': None,\n", - " 'name': 'Airquality 93f209d0-0c2c-11ed-8e19-276c36d4e620'}\n" + " 'name': 'Airquality'}\n" ] } ], "source": [ "response = container.create1({\n", - " \"name\": \"Airquality \" + str(uuid.uuid1()),\n", + " \"name\": \"Airquality\",\n", " \"repository\": \"mariadb\",\n", " \"tag\": \"10.5\"\n", "})\n", @@ -210,13 +212,13 @@ }, { "cell_type": "code", - "execution_count": 122, + "execution_count": 42, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'created': datetime.datetime(2022, 7, 25, 15, 15, 12, 611000, tzinfo=tzutc()),\n", + "{'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -225,14 +227,15 @@ " 'id': 2,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", - " 'hash': 'eb62216417341804986f04e6a5c06e2983b16188632d4a3332df6d4166105026',\n", + " 'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',\n", " 'id': 1,\n", - " 'internal_name': 'fda-userdb-airquality-93f209d0-0c2c-11ed-8e19-276c36d4e620',\n", + " 'internal_name': 'fda-userdb-airquality',\n", " 'is_public': None,\n", - " 'name': 'Airquality 93f209d0-0c2c-11ed-8e19-276c36d4e620'}\n" + " 'name': 'Airquality'}\n" ] } ], @@ -264,13 +267,13 @@ }, { "cell_type": "code", - "execution_count": 123, + "execution_count": 43, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'container': {'created': datetime.datetime(2022, 7, 25, 15, 15, 12, 611000, tzinfo=tzutc()),\n", + "{'container': {'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -279,15 +282,16 @@ " 'id': 2,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", - " 'hash': 'eb62216417341804986f04e6a5c06e2983b16188632d4a3332df6d4166105026',\n", + " 'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',\n", " 'id': 1,\n", - " 'internal_name': 'fda-userdb-airquality-93f209d0-0c2c-11ed-8e19-276c36d4e620',\n", + " 'internal_name': 'fda-userdb-airquality',\n", " 'is_public': None,\n", - " 'name': 'Airquality 93f209d0-0c2c-11ed-8e19-276c36d4e620'},\n", - " 'created': datetime.datetime(2022, 7, 25, 15, 15, 19, 123000, tzinfo=tzutc()),\n", + " 'name': 'Airquality'},\n", + " 'created': datetime.datetime(2022, 7, 26, 7, 57, 34, 419000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -296,6 +300,7 @@ " 'id': 2,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", @@ -303,13 +308,13 @@ " 'engine': 'mariadb:10.5',\n", " 'id': 1,\n", " 'is_public': True,\n", - " 'name': 'Airquality 97bae546-0c2c-11ed-8e19-276c36d4e620'}\n" + " 'name': 'Airquality'}\n" ] } ], "source": [ "response = database.create({\n", - " \"name\": \"Airquality \" + str(uuid.uuid1()),\n", + " \"name\": \"Airquality\",\n", " \"description\": \"Hourly measurements in Zürich, Switzerland\",\n", " \"is_public\": True\n", "}, container_id)\n", @@ -337,25 +342,25 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 44, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'contact': None,\n", - " 'container': {'created': datetime.datetime(2022, 7, 25, 15, 15, 12, 611000, tzinfo=tzutc()),\n", + " 'container': {'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),\n", " 'databases': None,\n", - " 'hash': 'eb62216417341804986f04e6a5c06e2983b16188632d4a3332df6d4166105026',\n", + " 'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',\n", " 'id': 1,\n", " 'image': {'id': 1, 'repository': 'mariadb', 'tag': '10.5'},\n", - " 'internal_name': 'fda-userdb-airquality-93f209d0-0c2c-11ed-8e19-276c36d4e620',\n", + " 'internal_name': 'fda-userdb-airquality',\n", " 'ip_address': None,\n", " 'is_public': None,\n", - " 'name': 'Airquality 93f209d0-0c2c-11ed-8e19-276c36d4e620',\n", - " 'port': 65245,\n", + " 'name': 'Airquality',\n", + " 'port': 46090,\n", " 'state': None},\n", - " 'created': datetime.datetime(2022, 7, 25, 15, 15, 19, 123000, tzinfo=tzutc()),\n", + " 'created': datetime.datetime(2022, 7, 26, 7, 57, 34, 419000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'containers': None,\n", @@ -367,57 +372,58 @@ " 'identifiers': None,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", " 'deleted': None,\n", " 'description': 'Hourly measurements in Zürich, Switzerland',\n", - " 'exchange': 'airquality_97bae546-0c2c-11ed-8e19-276c36d4e620',\n", + " 'exchange': 'airquality',\n", " 'id': 1,\n", " 'image': {'compiled': None,\n", - " 'date_formats': [{'created_at': datetime.datetime(2022, 7, 25, 15, 3, 44, 649000, tzinfo=tzutc()),\n", + " 'date_formats': [{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 320000, 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, 25, 15, 3, 44, 655000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 328000, 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, 25, 15, 3, 44, 658000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 332000, 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, 25, 15, 3, 44, 660000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 335000, 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, 25, 15, 3, 44, 662000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 338000, 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, 25, 15, 3, 44, 664000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 342000, 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, 25, 15, 3, 44, 667000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 344000, 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, 25, 15, 3, 44, 669000, tzinfo=tzutc()),\n", + " {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 347000, 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 +454,11 @@ " 'repository': 'mariadb',\n", " 'size': None,\n", " 'tag': '10.5'},\n", - " 'internal_name': 'airquality_97bae546-0c2c-11ed-8e19-276c36d4e620',\n", + " 'internal_name': 'airquality',\n", " 'is_public': True,\n", " 'language': None,\n", " 'license': None,\n", - " 'name': 'Airquality 97bae546-0c2c-11ed-8e19-276c36d4e620',\n", + " 'name': 'Airquality',\n", " 'publication': None,\n", " 'publisher': None,\n", " 'subjects': [],\n", @@ -486,13 +492,13 @@ }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 45, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'container': {'created': datetime.datetime(2022, 7, 25, 15, 15, 12, 611000, tzinfo=tzutc()),\n", + "{'container': {'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -501,15 +507,16 @@ " 'id': 2,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", - " 'hash': 'eb62216417341804986f04e6a5c06e2983b16188632d4a3332df6d4166105026',\n", + " 'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',\n", " 'id': 1,\n", - " 'internal_name': 'fda-userdb-airquality-93f209d0-0c2c-11ed-8e19-276c36d4e620',\n", + " 'internal_name': 'fda-userdb-airquality',\n", " 'is_public': None,\n", - " 'name': 'Airquality 93f209d0-0c2c-11ed-8e19-276c36d4e620'},\n", - " 'created': datetime.datetime(2022, 7, 25, 15, 15, 19, 123000, tzinfo=tzutc()),\n", + " 'name': 'Airquality'},\n", + " 'created': datetime.datetime(2022, 7, 26, 7, 57, 34, 419000, tzinfo=tzutc()),\n", " 'creator': {'affiliation': None,\n", " 'authorities': None,\n", " 'email': 'someone@example.com',\n", @@ -518,6 +525,7 @@ " 'id': 2,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", @@ -534,7 +542,7 @@ " 'engine': 'mariadb:10.5',\n", " 'id': 1,\n", " 'is_public': True,\n", - " 'name': 'Airquality 97bae546-0c2c-11ed-8e19-276c36d4e620'}\n" + " 'name': 'Airquality'}\n" ] } ], @@ -573,7 +581,7 @@ }, { "cell_type": "code", - "execution_count": 126, + "execution_count": 46, "outputs": [ { "name": "stdout", @@ -587,12 +595,13 @@ " 'id': 2,\n", " 'lastname': None,\n", " 'orcid': None,\n", + " 'theme_dark': False,\n", " 'titles_after': None,\n", " 'titles_before': None,\n", " 'username': 'user'},\n", " 'id': 1,\n", - " 'internal_name': 'airquality_97bae547-0c2c-11ed-8e19-276c36d4e620',\n", - " 'name': 'Airquality 97bae547-0c2c-11ed-8e19-276c36d4e620'}\n" + " 'internal_name': 'airquality_9bf3d186-0cb8-11ed-9462-8c8caada74c3',\n", + " 'name': 'Airquality 9bf3d186-0cb8-11ed-9462-8c8caada74c3'}\n" ] } ], @@ -669,7 +678,7 @@ }, { "cell_type": "code", - "execution_count": 127, + "execution_count": 47, "outputs": [ { "name": "stdout", @@ -695,7 +704,7 @@ " 'check_expression': None,\n", " 'column_concept': None,\n", " 'column_type': 'date',\n", - " 'date_format': {'created_at': datetime.datetime(2022, 7, 25, 15, 3, 44, 649000, tzinfo=tzutc()),\n", + " 'date_format': {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 320000, tzinfo=tzutc()),\n", " 'database_format': '%Y-%c-%d',\n", " 'example': '2022-01-30',\n", " 'has_time': False,\n", @@ -808,12 +817,12 @@ " 'name': 'Status',\n", " 'references': None,\n", " 'unique': False}],\n", - " 'created': datetime.datetime(2022, 7, 25, 15, 15, 20, 946000, tzinfo=tzutc()),\n", + " 'created': datetime.datetime(2022, 7, 26, 7, 57, 35, 791000, tzinfo=tzutc()),\n", " 'description': 'Airquality in Zürich, Switzerland',\n", " 'id': 1,\n", - " 'internal_name': 'airquality_97bae547-0c2c-11ed-8e19-276c36d4e620',\n", - " 'name': 'Airquality 97bae547-0c2c-11ed-8e19-276c36d4e620',\n", - " 'topic': 'airquality_97bae547-0c2c-11ed-8e19-276c36d4e620'}\n" + " 'internal_name': 'airquality_9bf3d186-0cb8-11ed-9462-8c8caada74c3',\n", + " 'name': 'Airquality 9bf3d186-0cb8-11ed-9462-8c8caada74c3',\n", + " 'topic': 'airquality_9bf3d186-0cb8-11ed-9462-8c8caada74c3'}\n" ] } ], @@ -844,7 +853,7 @@ }, { "cell_type": "code", - "execution_count": 128, + "execution_count": 48, "outputs": [ { "name": "stdout", @@ -885,7 +894,7 @@ }, { "cell_type": "code", - "execution_count": 129, + "execution_count": 49, "outputs": [ { "name": "stdout", @@ -945,16 +954,16 @@ }, { "cell_type": "code", - "execution_count": 130, + "execution_count": 50, "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': 'Mon, 25 Jul 2022 15:15:24 GMT'})\nHTTP response body: b'{\"status\":\"BAD_REQUEST\",\"message\":\"Failed to execute and map time-versioned query\",\"code\":\"error.table.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': 'Tue, 26 Jul 2022 07:57:39 GMT'})\nHTTP response body: b'{\"status\":\"BAD_REQUEST\",\"message\":\"Failed to execute and map time-versioned query\",\"code\":\"error.table.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 [130]\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 [50]\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 +971,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': 'Mon, 25 Jul 2022 15:15:24 GMT'})\nHTTP response body: b'{\"status\":\"BAD_REQUEST\",\"message\":\"Failed to execute and map time-versioned query\",\"code\":\"error.table.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': 'Tue, 26 Jul 2022 07:57:39 GMT'})\nHTTP response body: b'{\"status\":\"BAD_REQUEST\",\"message\":\"Failed to execute and map time-versioned query\",\"code\":\"error.table.malformed\"}'\n" ] } ], @@ -979,6 +988,18 @@ } } }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + } + }, { "cell_type": "code", "execution_count": null, diff --git a/fda-gateway-service/gateway/src/main/java/at/tuwien/config/GatewayConfig.java b/fda-gateway-service/gateway/src/main/java/at/tuwien/config/GatewayConfig.java index 28ed727397cf17ec5df84caee5315635bd8b4202..51fc4403b489183de1b268d1b5a683ab66a898a0 100644 --- a/fda-gateway-service/gateway/src/main/java/at/tuwien/config/GatewayConfig.java +++ b/fda-gateway-service/gateway/src/main/java/at/tuwien/config/GatewayConfig.java @@ -35,8 +35,9 @@ public class GatewayConfig { .uri("lb://fda-identifier-service")) .route("fda-query-service", r -> r.path("/api/container/**/database/**/query/**", "/api/container/**/database/**/table/**/history/**", - "/api/container/**/database/**/table/**/data/**", // TODO - "/api/container/**/database/**/table/**/query/**", // TODO + "/api/container/**/database/**/table/**/data/**", + "/api/container/**/database/**/table/**/query/**", + "/api/container/**/database/**/table/**/export/**", "/api/container/**/database/**/version/**") .and() .method("POST", "GET", "PUT", "DELETE") diff --git a/fda-query-service/services/src/main/java/at/tuwien/mapper/QueryMapper.java b/fda-query-service/services/src/main/java/at/tuwien/mapper/QueryMapper.java index 132e01c36763eda375f0daf52af8c88ba173675d..cbe4f641e367a2f57ccd9bdef54e381f488ba0cf 100644 --- a/fda-query-service/services/src/main/java/at/tuwien/mapper/QueryMapper.java +++ b/fda-query-service/services/src/main/java/at/tuwien/mapper/QueryMapper.java @@ -104,7 +104,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -121,7 +121,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -177,7 +177,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -323,7 +323,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -337,7 +337,7 @@ public interface QueryMapper { final StringBuilder versionPart = new StringBuilder(" FOR SYSTEM_TIME AS OF TIMESTAMP'") .append(mariaDbFormatter.format(query.getExecution())) .append("' "); - final Pattern pattern = Pattern.compile("from `?[a-zA-Z0-9_]+`?", Pattern.CASE_INSENSITIVE) /* https://mariadb.com/kb/en/columnstore-naming-conventions/ */; + final Pattern pattern = Pattern.compile("from `?[a-zA-Z0-9_-]+`?", Pattern.CASE_INSENSITIVE) /* https://mariadb.com/kb/en/columnstore-naming-conventions/ */; final Matcher matcher = pattern.matcher(query.getQuery()); if (!matcher.find()) { log.error("Failed to find 'from' clause in query"); @@ -355,7 +355,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -407,7 +407,7 @@ public interface QueryMapper { return ps; } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -440,7 +440,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -509,7 +509,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -560,7 +560,7 @@ public interface QueryMapper { return connection.prepareStatement(statement); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -626,7 +626,7 @@ public interface QueryMapper { return connection.prepareStatement(statement); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -681,7 +681,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -690,7 +690,7 @@ public interface QueryMapper { final List<Map<String, Object>> queryResult = new LinkedList<>(); while (result.next()) { /* map the result set to the columns through the stored metadata in the metadata database */ - int[] idx = new int[]{0}; + int[] idx = new int[]{1}; final Map<String, Object> map = new HashMap<>(); for (int i = 0; i < table.getColumns().size(); i++) { map.put(table.getColumns().get(i).getInternalName(), dataColumnToObject(result.getObject(idx[0]++), table.getColumns().get(i))); @@ -717,7 +717,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } @@ -857,7 +857,7 @@ public interface QueryMapper { return connection.prepareStatement(statement.toString()); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryMalformedException("Failed to prepare statement", e); } } diff --git a/fda-query-service/services/src/main/java/at/tuwien/mapper/StoreMapper.java b/fda-query-service/services/src/main/java/at/tuwien/mapper/StoreMapper.java index 5e3bfdf06f03c1b1d118a11ad380eb5a85d7776a..9fdb2e03a6fdaf53685580d72f488d1e49b749fd 100644 --- a/fda-query-service/services/src/main/java/at/tuwien/mapper/StoreMapper.java +++ b/fda-query-service/services/src/main/java/at/tuwien/mapper/StoreMapper.java @@ -58,7 +58,7 @@ public interface StoreMapper { return ps; } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryStoreException("Failed to prepare statement", e); } } @@ -69,7 +69,7 @@ public interface StoreMapper { return connection.prepareStatement(statement); } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryStoreException("Failed to prepare statement", e); } } @@ -84,7 +84,7 @@ public interface StoreMapper { return ps; } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryStoreException("Failed to prepare statement", e); } } @@ -107,7 +107,7 @@ public interface StoreMapper { return ps; } catch (SQLException e) { log.error("Failed to prepare statement"); - log.debug("failed to prepare statement {} reason {}", statement, e.getMessage()); + log.debug("failed to prepare statement {} reason: {}", statement, e.getMessage()); throw new QueryStoreException("Failed to prepare statement", e); } } diff --git a/fda-query-service/services/src/main/java/at/tuwien/service/impl/QueryServiceImpl.java b/fda-query-service/services/src/main/java/at/tuwien/service/impl/QueryServiceImpl.java index 1b8960b15b0869f709ca1b16ee04c1dd39ee28c5..64dd9d603cc3caef2249c0ab4f2fd7da5c2077c1 100644 --- a/fda-query-service/services/src/main/java/at/tuwien/service/impl/QueryServiceImpl.java +++ b/fda-query-service/services/src/main/java/at/tuwien/service/impl/QueryServiceImpl.java @@ -134,6 +134,7 @@ public class QueryServiceImpl extends HibernateConnector implements QueryService throw new TableMalformedException("Could not parse date from format", e); } catch (SQLException e) { log.error("Failed to map object"); + log.debug("failed to map object, reason: {}", e.getMessage()); throw new TableMalformedException("Failed to map object", e); } finally { dataSource.close(); diff --git a/fda-query-service/services/src/main/java/at/tuwien/service/impl/StoreServiceImpl.java b/fda-query-service/services/src/main/java/at/tuwien/service/impl/StoreServiceImpl.java index e5c4eeeb223ddcc27de8971ec86277244240d89a..4ce22a1acfe0526863e5f23b48adffcf39300c52 100644 --- a/fda-query-service/services/src/main/java/at/tuwien/service/impl/StoreServiceImpl.java +++ b/fda-query-service/services/src/main/java/at/tuwien/service/impl/StoreServiceImpl.java @@ -63,7 +63,7 @@ public class StoreServiceImpl extends HibernateConnector implements StoreService return storeMapper.resultSetToQueryList(resultSet); } catch (SQLException e) { log.error("Failed to find queries"); - log.debug("failed to find queries in container with id {} and database with id {}, reason {}", containerId, databaseId, e.getMessage()); + log.debug("failed to find queries in container with id {} and database with id {}, reason: {}", containerId, databaseId, e.getMessage()); throw new QueryStoreException("Query not found"); } finally { dataSource.close(); diff --git a/fda-ui/components/query/Results.vue b/fda-ui/components/query/Results.vue index bd26c3bb8f3605d441f2e01acc08abb233497e37..99aa267e17c5b0a2e40e830cd344bafab83fde3c 100644 --- a/fda-ui/components/query/Results.vue +++ b/fda-ui/components/query/Results.vue @@ -53,21 +53,14 @@ export default { console.debug('send data', data) const page = 0 const urlParams = `page=${page}&size=${this.options.itemsPerPage}` - const res = await this.$axios.put(`/api/container/ -${this.$route.params.container_id}/database/${this.$route.params.database_id}/query -${this.parent.queryId ? `/${this.parent.queryId}` : ''} -?${urlParams}`, data, { + const res = await this.$axios.put(`/api/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/query${this.parent.queryId ? `/${this.parent.queryId}` : ''}?${urlParams}`, data, { headers: this.headers }) console.debug('query result', res) this.$toast.success('Successfully executed query') + this.mapResults(res.data) this.loading = false this.parent.queryId = res.data.id - this.result.headers = this.parent.select.map((s) => { - return { text: s.name, value: s.name, sortable: false } - }) - this.result.rows = res.data.result - this.total = res.data.resultNumber } catch (err) { console.error('query execute', err) this.$toast.error('Could not execute query') @@ -95,13 +88,8 @@ ${this.$route.params.container_id}/database/${this.$route.params.database_id}/qu ?${urlParams}`, {}, { headers: this.headers }) + this.mapResults(res.data) this.loading = false - if (res.data.result.length) { - this.result.headers = this.buildHeaders(res.data.result[0]) - } - console.debug('query result', res.data) - this.result.rows = res.data.result - this.total = res.data.resultNumber } catch (err) { if (err.response.status !== 401 && err.response.status !== 405) { console.error('query execute', err) @@ -109,6 +97,14 @@ ${this.$route.params.container_id}/database/${this.$route.params.database_id}/qu } this.loading = false } + }, + mapResults (data) { + if (data.result.length) { + this.result.headers = this.buildHeaders(data.result[0]) + } + console.debug('query result', data) + this.result.rows = data.result + this.total = data.resultNumber } } } diff --git a/fda-ui/pages/container/_container_id/database/_database_id/table/_table_id/index.vue b/fda-ui/pages/container/_container_id/database/_database_id/table/_table_id/index.vue index df45aaa9c2049b173a3668ce9876ceca3e66d6ba..022231f0b0b6a107ac8eeddaa4206d0a0dad8420 100644 --- a/fda-ui/pages/container/_container_id/database/_database_id/table/_table_id/index.vue +++ b/fda-ui/pages/container/_container_id/database/_database_id/table/_table_id/index.vue @@ -27,6 +27,9 @@ <v-btn :disabled="!token" class="mb-1" :to="`/container/${$route.params.container_id}/database/${$route.params.database_id}/table/${$route.params.table_id}/import`"> <v-icon left>mdi-cloud-upload</v-icon> Import csv </v-btn> + <v-btn :disabled="error" class="ml-2 mb-1" :loading="downloadLoading" @click.stop="download"> + <v-icon left>mdi-download</v-icon> Data .csv + </v-btn> <v-btn v-if="false" color="primary" @@ -96,6 +99,7 @@ export default { footerProps: { 'items-per-page-options': [10, 20, 30, 40, 50] }, + downloadLoading: false, dateMenu: false, timeMenu: false, selection: [], @@ -172,6 +176,27 @@ export default { this.loadData() }, methods: { + async download () { + this.downloadLoading = true + try { + const res = await this.$axios.get(`/api/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}/export`, { + headers: { Authorization: `Bearer ${this.token}` }, + responseType: 'text' + }) + console.debug('export table', res) + const url = window.URL.createObjectURL(new Blob([res.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', 'table.csv') + document.body.appendChild(link) + link.click() + } catch (err) { + console.error('Could not export table', err) + this.$toast.error('Could not export table') + this.error = true + } + this.downloadLoading = false + }, addTuple () { this.edit = false const data = {}