Skip to content
Snippets Groups Projects

New stable release

16 files
+ 308
208
Compare changes
  • Side-by-side
  • Inline

Files

+ 31
41
%% Cell type:markdown id: tags:
# Test Jupyter Notebook
%% Cell type:code id: tags:
``` python
import time
import os
import shutil
import uuid
from api_authentication.api.authentication_endpoint_api import AuthenticationEndpointApi
from api_authentication.api.user_endpoint_api import UserEndpointApi
from api_container.api.container_endpoint_api import ContainerEndpointApi
from api_database.api.container_database_endpoint_api import ContainerDatabaseEndpointApi
from api_table.api.table_endpoint_api import TableEndpointApi
from api_query.api.table_data_endpoint_api import TableDataEndpointApi
from api_query.api.query_endpoint_api import QueryEndpointApi
from api_identifier.api.identifier_endpoint_api import IdentifierEndpointApi
from api_identifier.api.persistence_endpoint_api import PersistenceEndpointApi
authentication = AuthenticationEndpointApi()
user = UserEndpointApi()
container = ContainerEndpointApi()
database = ContainerDatabaseEndpointApi()
table = TableEndpointApi()
query = QueryEndpointApi()
data = TableDataEndpointApi()
identifier = IdentifierEndpointApi()
persistence = PersistenceEndpointApi()
username = "user"
password = "user"
email = "someone@example.com"
```
%% Cell type:markdown id: tags:
Create user
%% Cell type:code id: tags:
``` python
response = user.register({
"username": username,
"password": password,
"email": email
})
print(response)
```
%% Output
{'affiliation': None,
'authorities': [{'authority': 'ROLE_RESEARCHER'}],
'containers': None,
'databases': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'identifiers': None,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'}
%% Cell type:markdown id: tags:
Create token
%% Cell type:code id: tags:
``` python
response = authentication.authenticate_user1({
"username": username,
"password": password
})
user_id = response.id
token = response.token
container.api_client.default_headers = {"Authorization": "Bearer " + token}
database.api_client.default_headers = {"Authorization": "Bearer " + token}
table.api_client.default_headers = {"Authorization": "Bearer " + token}
data.api_client.default_headers = {"Authorization": "Bearer " + token}
query.api_client.default_headers = {"Authorization": "Bearer " + token}
identifier.api_client.default_headers = {"Authorization": "Bearer " + token}
user.api_client.default_headers = {"Authorization": "Bearer " + token}
persistence.api_client.default_headers = {"Authorization": "Bearer " + token}
```
%% Cell type:markdown id: tags:
Create container
%% Cell type:code id: tags:
``` python
response = container.create1({
"name": "Airquality",
"repository": "mariadb",
"tag": "10.5"
})
container_id = response.id
print(response)
```
%% Output
{'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),
{'created': datetime.datetime(2022, 7, 26, 13, 5, 36, 339000, tzinfo=tzutc()),
'creator': {'affiliation': None,
'authorities': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'},
'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',
'hash': '5dc114629602472d0bb93f4aedd6a38f161dd59ed129247511c83767fcba0a19',
'id': 1,
'internal_name': 'fda-userdb-airquality',
'is_public': None,
'name': 'Airquality'}
%% Cell type:markdown id: tags:
Start container
%% Cell type:code id: tags:
``` python
response = container.modify({
"action": "start"
}, container_id)
time.sleep(5)
print(response)
```
%% Output
{'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),
{'created': datetime.datetime(2022, 7, 26, 13, 5, 36, 339000, tzinfo=tzutc()),
'creator': {'affiliation': None,
'authorities': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'},
'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',
'hash': '5dc114629602472d0bb93f4aedd6a38f161dd59ed129247511c83767fcba0a19',
'id': 1,
'internal_name': 'fda-userdb-airquality',
'is_public': None,
'name': 'Airquality'}
%% Cell type:markdown id: tags:
Create database
%% Cell type:code id: tags:
``` python
response = database.create({
"name": "Airquality",
"description": "Hourly measurements in Zürich, Switzerland",
"is_public": True
}, container_id)
database_id = response.id
print(response)
```
%% Output
{'container': {'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),
{'container': {'created': datetime.datetime(2022, 7, 26, 13, 5, 36, 339000, tzinfo=tzutc()),
'creator': {'affiliation': None,
'authorities': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'},
'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',
'hash': '5dc114629602472d0bb93f4aedd6a38f161dd59ed129247511c83767fcba0a19',
'id': 1,
'internal_name': 'fda-userdb-airquality',
'is_public': None,
'name': 'Airquality'},
'created': datetime.datetime(2022, 7, 26, 7, 57, 34, 419000, tzinfo=tzutc()),
'created': datetime.datetime(2022, 7, 26, 13, 5, 42, 453000, tzinfo=tzutc()),
'creator': {'affiliation': None,
'authorities': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'},
'description': 'Hourly measurements in Zürich, Switzerland',
'engine': 'mariadb:10.5',
'id': 1,
'is_public': True,
'name': 'Airquality'}
%% Cell type:markdown id: tags:
Inspect database
%% Cell type:code id: tags:
``` python
response = database.find_by_id(container_id, database_id)
database_exchange = response.exchange
print(response)
```
%% Output
{'contact': None,
'container': {'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),
'container': {'created': datetime.datetime(2022, 7, 26, 13, 5, 36, 339000, tzinfo=tzutc()),
'databases': None,
'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',
'hash': '5dc114629602472d0bb93f4aedd6a38f161dd59ed129247511c83767fcba0a19',
'id': 1,
'image': {'id': 1, 'repository': 'mariadb', 'tag': '10.5'},
'internal_name': 'fda-userdb-airquality',
'ip_address': None,
'is_public': None,
'name': 'Airquality',
'port': 46090,
'port': 35358,
'state': None},
'created': datetime.datetime(2022, 7, 26, 7, 57, 34, 419000, tzinfo=tzutc()),
'created': datetime.datetime(2022, 7, 26, 13, 5, 42, 453000, tzinfo=tzutc()),
'creator': {'affiliation': None,
'authorities': None,
'containers': None,
'databases': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'identifiers': None,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'},
'deleted': None,
'description': 'Hourly measurements in Zürich, Switzerland',
'exchange': 'airquality',
'id': 1,
'image': {'compiled': None,
'date_formats': [{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 320000, tzinfo=tzutc()),
'date_formats': [{'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 747000, tzinfo=tzutc()),
'database_format': '%Y-%c-%d',
'example': '2022-01-30',
'has_time': False,
'id': 1,
'unix_format': 'yyyy-MM-dd'},
{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 328000, tzinfo=tzutc()),
{'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 753000, tzinfo=tzutc()),
'database_format': '%d.%c.%Y',
'example': '30.01.2022',
'has_time': False,
'id': 2,
'unix_format': 'yyyy-MM-dd'},
{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 332000, tzinfo=tzutc()),
{'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 756000, tzinfo=tzutc()),
'database_format': '%d.%c.%y',
'example': '30.01.22',
'has_time': False,
'id': 3,
'unix_format': 'yyyy-MM-dd'},
{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 335000, tzinfo=tzutc()),
{'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 759000, tzinfo=tzutc()),
'database_format': '%c/%d/%Y',
'example': '01/30/2022',
'has_time': False,
'id': 4,
'unix_format': 'yyyy-MM-dd'},
{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 338000, tzinfo=tzutc()),
{'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 762000, tzinfo=tzutc()),
'database_format': '%c/%d/%y',
'example': '01/30/22',
'has_time': False,
'id': 5,
'unix_format': 'yyyy-MM-dd'},
{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 342000, tzinfo=tzutc()),
{'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 765000, tzinfo=tzutc()),
'database_format': '%Y-%c-%d %H:%i:%S.%f',
'example': '2022-01-30 13:44:25.0',
'has_time': True,
'id': 6,
'unix_format': 'yyyy-MM-dd HH:mm:ss.SSSSSS'},
{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 344000, tzinfo=tzutc()),
{'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 767000, tzinfo=tzutc()),
'database_format': '%Y-%c-%d %H:%i:%S',
'example': '2022-01-30 13:44:25',
'has_time': True,
'id': 7,
'unix_format': 'yyyy-MM-dd HH:mm:ss'},
{'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 347000, tzinfo=tzutc()),
{'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 770000, tzinfo=tzutc()),
'database_format': '%d.%c.%Y %H:%i:%S',
'example': '30.01.2022 13:44:25',
'has_time': True,
'id': 8,
'unix_format': 'dd.MM.yyyy HH:mm:ss'}],
'default_port': 3306,
'dialect': 'org.hibernate.dialect.MariaDBDialect',
'driver_class': 'org.mariadb.jdbc.Driver',
'environment': [{'iid': 1,
'key': 'ROOT',
'type': 'PRIVILEGED_USERNAME',
'value': 'root'},
{'iid': 1,
'key': 'MARIADB_ROOT_PASSWORD',
'type': 'PRIVILEGED_PASSWORD',
'value': 'mariadb'},
{'iid': 1,
'key': 'MARIADB_USER',
'type': 'USERNAME',
'value': 'mariadb'},
{'iid': 1,
'key': 'MARIADB_PASSWORD',
'type': 'PASSWORD',
'value': 'mariadb'}],
'hash': None,
'id': 1,
'jdbc_method': 'mariadb',
'repository': 'mariadb',
'size': None,
'tag': '10.5'},
'internal_name': 'airquality',
'is_public': True,
'language': None,
'license': None,
'name': 'Airquality',
'publication': None,
'publisher': None,
'subjects': [],
'tables': []}
%% Cell type:markdown id: tags:
Add metadata to database
%% Cell type:code id: tags:
``` python
response = database.update({
"description": "This dataset includes daily values from 1983 to the current day, divided into annual files. This includes the maximum hourly average and the number of times the hourly average limit value for ozone was exceeded and the daily averages for sulfur dioxide (SO2), carbon monoxide (CO), nitrogen oxide (NOx), nitrogen monoxide (NO), nitrogen dioxide (NO2), particulate matter (PM10 and PM2.5). ) and particle number (PN), provided that they are of sufficient quality. The values of the completed day for the current year are updated every 30 minutes after midnight (UTC+1).",
"publisher": "Technical University of Vienna",
"license": {
"identifier": "CC0-1.0",
"uri": "https://creativecommons.org/publicdomain/zero/1.0/legalcode"
},
"language": "en",
"is_public": True,
"publication": "2022-07-19"
}, container_id, database_id)
print(response)
```
%% Output
{'container': {'created': datetime.datetime(2022, 7, 26, 7, 57, 28, 27000, tzinfo=tzutc()),
{'container': {'created': datetime.datetime(2022, 7, 26, 13, 5, 36, 339000, tzinfo=tzutc()),
'creator': {'affiliation': None,
'authorities': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'},
'hash': '0ba17c47b0eec5cd73dd6a9164bed510b159191076dda38165906733a821cd16',
'hash': '5dc114629602472d0bb93f4aedd6a38f161dd59ed129247511c83767fcba0a19',
'id': 1,
'internal_name': 'fda-userdb-airquality',
'is_public': None,
'name': 'Airquality'},
'created': datetime.datetime(2022, 7, 26, 7, 57, 34, 419000, tzinfo=tzutc()),
'created': datetime.datetime(2022, 7, 26, 13, 5, 42, 453000, tzinfo=tzutc()),
'creator': {'affiliation': None,
'authorities': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'},
'description': 'This dataset includes daily values from 1983 to the current '
'day, divided into annual files. This includes the maximum '
'hourly average and the number of times the hourly average '
'limit value for ozone was exceeded and the daily averages for '
'sulfur dioxide (SO2), carbon monoxide (CO), nitrogen oxide '
'(NOx), nitrogen monoxide (NO), nitrogen dioxide (NO2), '
'particulate matter (PM10 and PM2.5). ) and particle number '
'(PN), provided that they are of sufficient quality. The '
'values of the completed day for the current year are updated '
'every 30 minutes after midnight (UTC+1).',
'engine': 'mariadb:10.5',
'id': 1,
'is_public': True,
'name': 'Airquality'}
%% Cell type:markdown id: tags:
Create table
%% Cell type:code id: tags:
``` python
response = table.create({
"name": "Airquality " + str(uuid.uuid1()),
"description": "Airquality in Zürich, Switzerland",
"columns": [{
"name": "Date",
"type": "date",
"dfid": 1,
"unique": False,
"primary_key": False,
"null_allowed": True,
}, {
"name": "Location",
"type": "string",
"unique": False,
"primary_key": False,
"null_allowed": True,
}, {
"name": "Parameter",
"type": "string",
"unique": False,
"primary_key": False,
"null_allowed": True,
}, {
"name": "Interval",
"type": "string",
"unique": False,
"primary_key": False,
"null_allowed": True,
}, {
"name": "Unit",
"type": "string",
"unique": False,
"primary_key": False,
"null_allowed": True,
}, {
"name": "Value",
"type": "decimal",
"unique": False,
"primary_key": False,
"null_allowed": True,
}, {
"name": "Status",
"type": "string",
"unique": False,
"primary_key": False,
"null_allowed": True,
}]
}, container_id, database_id)
table_id = response.id
print(response)
```
%% Output
{'creator': {'affiliation': None,
'authorities': None,
'email': 'someone@example.com',
'email_verified': False,
'firstname': None,
'id': 2,
'lastname': None,
'orcid': None,
'theme_dark': False,
'titles_after': None,
'titles_before': None,
'username': 'user'},
'id': 1,
'internal_name': 'airquality_9bf3d186-0cb8-11ed-9462-8c8caada74c3',
'name': 'Airquality 9bf3d186-0cb8-11ed-9462-8c8caada74c3'}
'internal_name': 'airquality_a7a429a6-0ce3-11ed-9462-8c8caada74c3',
'name': 'Airquality a7a429a6-0ce3-11ed-9462-8c8caada74c3'}
%% Cell type:markdown id: tags:
Inspect table
%% Cell type:code id: tags:
``` python
response = table.find_by_id(container_id, database_id, table_id)
table_internal_name = response.internal_name
table_topic = response.topic
print(response)
```
%% Output
{'columns': [{'auto_generated': True,
'check_expression': None,
'column_concept': None,
'column_type': 'number',
'date_format': None,
'decimal_digits_after': None,
'decimal_digits_before': None,
'enum_values': [],
'foreign_key': None,
'id': 1,
'internal_name': 'id',
'is_null_allowed': False,
'is_primary_key': True,
'name': 'id',
'references': None,
'unique': True},
{'auto_generated': False,
'check_expression': None,
'column_concept': None,
'column_type': 'date',
'date_format': {'created_at': datetime.datetime(2022, 7, 26, 7, 56, 9, 320000, tzinfo=tzutc()),
'date_format': {'created_at': datetime.datetime(2022, 7, 26, 13, 1, 15, 747000, tzinfo=tzutc()),
'database_format': '%Y-%c-%d',
'example': '2022-01-30',
'has_time': False,
'id': 1,
'unix_format': 'yyyy-MM-dd'},
'decimal_digits_after': None,
'decimal_digits_before': None,
'enum_values': [],
'foreign_key': None,
'id': 2,
'internal_name': 'date',
'is_null_allowed': True,
'is_primary_key': False,
'name': 'Date',
'references': None,
'unique': False},
{'auto_generated': False,
'check_expression': None,
'column_concept': None,
'column_type': 'string',
'date_format': None,
'decimal_digits_after': None,
'decimal_digits_before': None,
'enum_values': [],
'foreign_key': None,
'id': 3,
'internal_name': 'location',
'is_null_allowed': True,
'is_primary_key': False,
'name': 'Location',
'references': None,
'unique': False},
{'auto_generated': False,
'check_expression': None,
'column_concept': None,
'column_type': 'string',
'date_format': None,
'decimal_digits_after': None,
'decimal_digits_before': None,
'enum_values': [],
'foreign_key': None,
'id': 4,
'internal_name': 'parameter',
'is_null_allowed': True,
'is_primary_key': False,
'name': 'Parameter',
'references': None,
'unique': False},
{'auto_generated': False,
'check_expression': None,
'column_concept': None,
'column_type': 'string',
'date_format': None,
'decimal_digits_after': None,
'decimal_digits_before': None,
'enum_values': [],
'foreign_key': None,
'id': 5,
'internal_name': 'interval',
'is_null_allowed': True,
'is_primary_key': False,
'name': 'Interval',
'references': None,
'unique': False},
{'auto_generated': False,
'check_expression': None,
'column_concept': None,
'column_type': 'string',
'date_format': None,
'decimal_digits_after': None,
'decimal_digits_before': None,
'enum_values': [],
'foreign_key': None,
'id': 6,
'internal_name': 'unit',
'is_null_allowed': True,
'is_primary_key': False,
'name': 'Unit',
'references': None,
'unique': False},
{'auto_generated': False,
'check_expression': None,
'column_concept': None,
'column_type': 'decimal',
'date_format': None,
'decimal_digits_after': None,
'decimal_digits_before': None,
'enum_values': [],
'foreign_key': None,
'id': 7,
'internal_name': 'value',
'is_null_allowed': True,
'is_primary_key': False,
'name': 'Value',
'references': None,
'unique': False},
{'auto_generated': False,
'check_expression': None,
'column_concept': None,
'column_type': 'string',
'date_format': None,
'decimal_digits_after': None,
'decimal_digits_before': None,
'enum_values': [],
'foreign_key': None,
'id': 8,
'internal_name': 'status',
'is_null_allowed': True,
'is_primary_key': False,
'name': 'Status',
'references': None,
'unique': False}],
'created': datetime.datetime(2022, 7, 26, 7, 57, 35, 791000, tzinfo=tzutc()),
'created': datetime.datetime(2022, 7, 26, 13, 5, 43, 660000, tzinfo=tzutc()),
'description': 'Airquality in Zürich, Switzerland',
'id': 1,
'internal_name': 'airquality_9bf3d186-0cb8-11ed-9462-8c8caada74c3',
'name': 'Airquality 9bf3d186-0cb8-11ed-9462-8c8caada74c3',
'topic': 'airquality_9bf3d186-0cb8-11ed-9462-8c8caada74c3'}
'internal_name': 'airquality_a7a429a6-0ce3-11ed-9462-8c8caada74c3',
'name': 'Airquality a7a429a6-0ce3-11ed-9462-8c8caada74c3',
'topic': 'airquality_a7a429a6-0ce3-11ed-9462-8c8caada74c3'}
%% Cell type:markdown id: tags:
Import .csv
%% Cell type:code id: tags:
``` python
shutil.copyfile(os.getcwd() + "/resources/ugz_ogd_air_h1_2021.csv", "/tmp/ugz_ogd_air_h1_2021.csv")
response = data.import_csv({
"location": "/tmp/ugz_ogd_air_h1_2021.csv",
"separator": ",",
"quote": "\"",
"skip_lines": 1
}, container_id, database_id, table_id)
print(response)
```
%% Output
None
%% Cell type:markdown id: tags:
Create subset
%% Cell type:code id: tags:
``` python
response = query.execute({
"statement": "select `date`, `location`, `parameter`, `interval`, `unit`, `value`, `status` from `" + table_internal_name + "` where `location` = 'Schimmelstrasse'"
}, container_id, database_id, page=0, size=3)
query_id = response.id
print(response)
```
%% Output
{'id': 1,
'result': [{'date': '2021-01-01T00:00:00Z',
'interval': 'h1',
'location': 'Schimmelstrasse',
'parameter': 'NOx',
'status': 'tentative',
'unit': 'ppb',
'value': 41.66},
{'date': '2021-01-01T00:00:00Z',
'interval': 'h1',
'location': 'Schimmelstrasse',
'parameter': 'NO',
'status': 'tentative',
'unit': 'µg/m3',
'value': 21.64},
{'date': '2021-01-01T00:00:00Z',
'interval': 'h1',
'location': 'Schimmelstrasse',
'parameter': 'NO2',
'status': 'tentative',
'unit': 'µg/m3',
'value': 46.49}],
'result_number': 52548}
%% Cell type:markdown id: tags:
Create invalid subset
%% Cell type:code id: tags:
``` python
response = query.execute({
"statement": "select `date`, `location`, `parameter`, `interval`, `unit`, `value`, `status` from `" + table_internal_name + "` where `foo` = 'bar'"
}, container_id, database_id, page=0, size=3)
print(response)
```
%% Output
---------------------------------------------------------------------------
ApiException Traceback (most recent call last)
Input In [50], in <cell line: 1>()
Input In [125], in <cell line: 1>()
----> 1 response = query.execute({
2 "statement": "select `date`, `location`, `parameter`, `interval`, `unit`, `value`, `status` from `" + table_internal_name + "` where `foo` = 'bar'"
3 }, container_id, database_id, page=0, size=3)
4 print(response)
File ~/Projects/fda-services/.jupyter/api_query/api/query_endpoint_api.py:57, in QueryEndpointApi.execute(self, body, id, database_id, **kwargs)
55 return self.execute_with_http_info(body, id, database_id, **kwargs) # noqa: E501
56 else:
---> 57 (data) = self.execute_with_http_info(body, id, database_id, **kwargs) # noqa: E501
58 return data
File ~/Projects/fda-services/.jupyter/api_query/api/query_endpoint_api.py:140, in QueryEndpointApi.execute_with_http_info(self, body, id, database_id, **kwargs)
137 # Authentication setting
138 auth_settings = ['bearerAuth'] # noqa: E501
--> 140 return self.api_client.call_api(
141 '/api/container/{id}/database/{databaseId}/query', 'PUT',
142 path_params,
143 query_params,
144 header_params,
145 body=body_params,
146 post_params=form_params,
147 files=local_var_files,
148 response_type='QueryResultDto', # noqa: E501
149 auth_settings=auth_settings,
150 async_req=params.get('async_req'),
151 _return_http_data_only=params.get('_return_http_data_only'),
152 _preload_content=params.get('_preload_content', True),
153 _request_timeout=params.get('_request_timeout'),
154 collection_formats=collection_formats)
File ~/Projects/fda-services/.jupyter/api_query/api_client.py:316, in ApiClient.call_api(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)
279 """Makes the HTTP request (synchronous) and returns deserialized data.
280
281 To make an async request, set the async_req parameter.
(...)
313 then the method will return the response directly.
314 """
315 if not async_req:
--> 316 return self.__call_api(resource_path, method,
317 path_params, query_params, header_params,
318 body, post_params, files,
319 response_type, auth_settings,
320 _return_http_data_only, collection_formats,
321 _preload_content, _request_timeout)
322 else:
323 thread = self.pool.apply_async(self.__call_api, (resource_path,
324 method, path_params, query_params,
325 header_params, body,
(...)
329 collection_formats,
330 _preload_content, _request_timeout))
File ~/Projects/fda-services/.jupyter/api_query/api_client.py:148, in ApiClient.__call_api(self, resource_path, method, path_params, query_params, header_params, body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout)
145 url = self.configuration.host + resource_path
147 # perform request and return response
--> 148 response_data = self.request(
149 method, url, query_params=query_params, headers=header_params,
150 post_params=post_params, body=body,
151 _preload_content=_preload_content,
152 _request_timeout=_request_timeout)
154 self.last_response = response_data
156 return_data = response_data
File ~/Projects/fda-services/.jupyter/api_query/api_client.py:366, in ApiClient.request(self, method, url, query_params, headers, post_params, body, _preload_content, _request_timeout)
358 return self.rest_client.POST(url,
359 query_params=query_params,
360 headers=headers,
(...)
363 _request_timeout=_request_timeout,
364 body=body)
365 elif method == "PUT":
--> 366 return self.rest_client.PUT(url,
367 query_params=query_params,
368 headers=headers,
369 post_params=post_params,
370 _preload_content=_preload_content,
371 _request_timeout=_request_timeout,
372 body=body)
373 elif method == "PATCH":
374 return self.rest_client.PATCH(url,
375 query_params=query_params,
376 headers=headers,
(...)
379 _request_timeout=_request_timeout,
380 body=body)
File ~/Projects/fda-services/.jupyter/api_query/rest.py:273, in RESTClientObject.PUT(self, url, headers, query_params, post_params, body, _preload_content, _request_timeout)
271 def PUT(self, url, headers=None, query_params=None, post_params=None,
272 body=None, _preload_content=True, _request_timeout=None):
--> 273 return self.request("PUT", url,
274 headers=headers,
275 query_params=query_params,
276 post_params=post_params,
277 _preload_content=_preload_content,
278 _request_timeout=_request_timeout,
279 body=body)
File ~/Projects/fda-services/.jupyter/api_query/rest.py:222, in RESTClientObject.request(self, method, url, query_params, headers, body, post_params, _preload_content, _request_timeout)
219 logger.debug("response body: %s", r.data)
221 if not 200 <= r.status <= 299:
--> 222 raise ApiException(http_resp=r)
224 return r
ApiException: (400)
Reason: Bad Request
HTTP 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'})
HTTP 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 13:05:46 GMT'})
HTTP response body: b'{"status":"BAD_REQUEST","message":"Failed to execute and map time-versioned query","code":"error.table.malformed"}'
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
Loading