Skip to content

Commit

Permalink
Change adql from 2.0 to 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kimakan committed Aug 28, 2024
1 parent d747279 commit ef242f5
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion daiquiri/core/renderers/vosi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion daiquiri/query/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 12 additions & 4 deletions daiquiri/query/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {}
}
Expand All @@ -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': '"'
}
Expand Down
2 changes: 1 addition & 1 deletion daiquiri/query/static/query/js/forms/box.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion daiquiri/query/static/query/js/forms/cone.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions daiquiri/query/tests/test_viewset_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()

Expand Down
6 changes: 3 additions & 3 deletions daiquiri/query/tests/test_viewset_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions daiquiri/tap/tests/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')

Expand All @@ -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')

Expand Down Expand Up @@ -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')
Expand Down
12 changes: 6 additions & 6 deletions daiquiri/tap/tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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')

Expand All @@ -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')

Expand All @@ -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')

Expand Down
1 change: 1 addition & 0 deletions daiquiri/tap/vo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
},
Expand Down

0 comments on commit ef242f5

Please sign in to comment.