From ef242f5a30967a19a832757b535abc5358ef4ba7 Mon Sep 17 00:00:00 2001 From: kimakan <45099849+kimakan@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:08:33 +0200 Subject: [PATCH] Change adql from 2.0 to 2.1 --- daiquiri/core/renderers/vosi.py | 2 +- daiquiri/query/process.py | 2 +- daiquiri/query/settings.py | 16 ++++++++++++---- daiquiri/query/static/query/js/forms/box.js | 2 +- daiquiri/query/static/query/js/forms/cone.js | 2 +- daiquiri/query/tests/test_viewset_example.py | 4 ++-- daiquiri/query/tests/test_viewset_job.py | 6 +++--- daiquiri/tap/tests/test_async.py | 8 ++++---- daiquiri/tap/tests/test_sync.py | 12 ++++++------ daiquiri/tap/vo.py | 1 + 10 files changed, 32 insertions(+), 23 deletions(-) diff --git a/daiquiri/core/renderers/vosi.py b/daiquiri/core/renderers/vosi.py index 6edbe3fa9..e2db314cb 100644 --- a/daiquiri/core/renderers/vosi.py +++ b/daiquiri/core/renderers/vosi.py @@ -65,7 +65,7 @@ def render_capability(self, capability): for language in capability.get('languages', []): self.start('language') self.node('name', {}, language.get('name')) - self.node('version', {}, language.get('version')) + self.node('version', {'ivo-id': language.get('ivo-id', None)}, language.get('version')) self.node('description', {}, language.get('description')) self.end('language') diff --git a/daiquiri/query/process.py b/daiquiri/query/process.py index 6ca29ae0c..5188afaee 100644 --- a/daiquiri/query/process.py +++ b/daiquiri/query/process.py @@ -125,7 +125,7 @@ def translate_query(query_language, query): adapter = DatabaseAdapter() # translate adql -> mysql string - if query_language == 'adql-2.0': + if query_language == 'adql-2.1': try: translator = cache.get_or_set('translator', ADQLQueryTranslator(), 3600) translator.set_query(query) diff --git a/daiquiri/query/settings.py b/daiquiri/query/settings.py index 4ad63b217..1e684b170 100644 --- a/daiquiri/query/settings.py +++ b/daiquiri/query/settings.py @@ -6,8 +6,8 @@ QUERY_ANONYMOUS = False QUERY_USER_SCHEMA_PREFIX = 'daiquiri_user_' QUERY_QUOTA = { - 'anonymous': '100Mb', - 'user': '10000Mb', + 'anonymous': '1000Mb', + 'user': '1000Mb', 'users': {}, 'groups': {} } @@ -34,8 +34,16 @@ QUERY_LANGUAGES = [ { 'key': 'adql', - 'version': 2.0, - 'label': 'ADQL', + 'version': 2.1, + 'ivo-id': 'ivo://ivoa.net/std/adql#v2.1', + 'label': 'ADQL-2.1', + 'description': '', + 'quote_char': '"' + }, + { + 'key': 'postgresql', + 'version': 16.2, + 'label': 'PostgreSQL-16.2', 'description': '', 'quote_char': '"' } diff --git a/daiquiri/query/static/query/js/forms/box.js b/daiquiri/query/static/query/js/forms/box.js index fefb860cc..2c4ed8ee1 100644 --- a/daiquiri/query/static/query/js/forms/box.js +++ b/daiquiri/query/static/query/js/forms/box.js @@ -18,7 +18,7 @@ app.factory('BoxFormService', ['QueryService', function(QueryService) { service.submit = function() { service.values.query = 'SELECT x, y, z FROM daiquiri_data_sim.particles WHERE x BETWEEN ' + service.values.x_min + ' AND ' + service.values.x_max + ' AND y BETWEEN ' + service.values.x_min + ' AND ' + service.values.y_max + ' AND z BETWEEN ' + service.values.z_min + ' AND ' + service.values.z_max ; - service.values.query_language = 'adql-2.0'; + service.values.query_language = 'adql-2.1'; QueryService.submit_job(service.values) .then(function() { diff --git a/daiquiri/query/static/query/js/forms/cone.js b/daiquiri/query/static/query/js/forms/cone.js index 4f9de3f58..a18d2222b 100644 --- a/daiquiri/query/static/query/js/forms/cone.js +++ b/daiquiri/query/static/query/js/forms/cone.js @@ -15,7 +15,7 @@ app.factory('ConeFormService', ['QueryService', function(QueryService) { service.submit = function() { service.values.query = 'SELECT ra, de FROM daiquiri_data_obs.stars WHERE SQRT(POWER(ra - ' + service.values.ra + ', 2) + POWER(de - ' + service.values.de + ', 2)) <= ' + service.values.radius / 60.0 / 60.0; - service.values.query_language = 'adql-2.0'; + service.values.query_language = 'adql-2.1'; QueryService.submit_job(service.values) .then(function() { diff --git a/daiquiri/query/tests/test_viewset_example.py b/daiquiri/query/tests/test_viewset_example.py index c2326a38c..a2a266c2b 100644 --- a/daiquiri/query/tests/test_viewset_example.py +++ b/daiquiri/query/tests/test_viewset_example.py @@ -78,7 +78,7 @@ def test_create(db, client, mocker, username, password): 'name': 'Test', 'query_string': 'SELECT foo FROM bar', 'access_level': 'PUBLIC', - 'query_language': 'adql-2.0' + 'query_language': 'adql-2.1' }) assert response.status_code == status_map['create'][username], response.json() @@ -95,7 +95,7 @@ def test_update(db, client, mocker, username, password, pk): 'name': 'Test', 'query_string': 'SELECT foo FROM bar', 'access_level': 'PUBLIC', - 'query_language': 'adql-2.0' + 'query_language': 'adql-2.1' }, content_type='application/json') assert response.status_code == status_map['update'][username], response.json() diff --git a/daiquiri/query/tests/test_viewset_job.py b/daiquiri/query/tests/test_viewset_job.py index abeedb322..fe3fcee2d 100644 --- a/daiquiri/query/tests/test_viewset_job.py +++ b/daiquiri/query/tests/test_viewset_job.py @@ -123,7 +123,7 @@ def test_create_public(db, client, mocker, query): url = reverse(urlnames['list']) response = client.post(url, { - 'query_language': 'adql-2.0', + 'query_language': 'adql-2.1', 'query': query }) assert response.status_code == 201, response.json() @@ -142,7 +142,7 @@ def test_create_internal(db, client, mocker, username, password, query): url = reverse(urlnames['list']) response = client.post(url, { - 'query_language': 'adql-2.0', + 'query_language': 'adql-2.1', 'query': query }) assert response.status_code == status_map['create_internal'][username], response.json() @@ -161,7 +161,7 @@ def test_create_private(db, client, mocker, username, password, query): url = reverse(urlnames['list']) response = client.post(url, { - 'query_language': 'adql-2.0', + 'query_language': 'adql-2.1', 'query': query }) assert response.status_code == status_map['create_private'][username], response.json() diff --git a/daiquiri/tap/tests/test_async.py b/daiquiri/tap/tests/test_async.py index 29a737509..d53c144db 100644 --- a/daiquiri/tap/tests/test_async.py +++ b/daiquiri/tap/tests/test_async.py @@ -147,7 +147,7 @@ def test_post_job_list_create_public(db, client, username, password, query): url = reverse(url_names['list']) response = client.post(url, urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }), content_type='application/x-www-form-urlencoded') assert response.status_code == 303, response.content @@ -170,7 +170,7 @@ def test_post_job_list_create_internal(db, client, username, password, query): url = reverse(url_names['list']) response = client.post(url, urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }), content_type='application/x-www-form-urlencoded') @@ -197,7 +197,7 @@ def test_post_job_list_create_private(db, client, username, password, query): url = reverse(url_names['list']) response = client.post(url, urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }), content_type='application/x-www-form-urlencoded') @@ -231,7 +231,7 @@ def test_post_job_list_create_run(db, client, mocker, username, password, query) url = reverse(url_names['list']) response = client.post(url, urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query, 'PHASE': 'RUN' }), content_type='application/x-www-form-urlencoded') diff --git a/daiquiri/tap/tests/test_sync.py b/daiquiri/tap/tests/test_sync.py index c513ea02c..641961849 100644 --- a/daiquiri/tap/tests/test_sync.py +++ b/daiquiri/tap/tests/test_sync.py @@ -50,7 +50,7 @@ def test_create_post_public(db, client, username, password, query): client.login(username=username, password=password) url = reverse(url_names['list']) + '?' + urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }) response = client.get(url) @@ -69,7 +69,7 @@ def test_create_post_internal(db, client, username, password, query): client.login(username=username, password=password) url = reverse(url_names['list']) + '?' + urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }) response = client.get(url) @@ -91,7 +91,7 @@ def test_create_post_private(db, client, username, password, query): client.login(username=username, password=password) url = reverse(url_names['list']) + '?' + urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }) response = client.get(url) @@ -114,7 +114,7 @@ def test_post_job_list_create_public(db, client, username, password, query): url = reverse(url_names['list']) response = client.post(url, urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }), content_type='application/x-www-form-urlencoded') @@ -133,7 +133,7 @@ def test_post_job_list_create_internal(db, client, username, password, query): url = reverse(url_names['list']) response = client.post(url, urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }), content_type='application/x-www-form-urlencoded') @@ -155,7 +155,7 @@ def test_post_job_list_create_private(db, client, username, password, query): url = reverse(url_names['list']) response = client.post(url, urlencode({ - 'LANG': 'adql-2.0', + 'LANG': 'adql-2.1', 'QUERY': query }), content_type='application/x-www-form-urlencoded') diff --git a/daiquiri/tap/vo.py b/daiquiri/tap/vo.py index af6c93887..e91e6cf24 100644 --- a/daiquiri/tap/vo.py +++ b/daiquiri/tap/vo.py @@ -51,6 +51,7 @@ def get_capabilities(): 'languages': [{ 'name': language['key'], 'version': language['version'], + 'ivo-id': language.get('ivo-id', None), 'description': language['description'], } for language in settings.QUERY_LANGUAGES] },