Compare commits

...

10 Commits

Author SHA1 Message Date
Maxime Beauchemin
f554c7f6a6 0.20.6 2017-11-14 21:26:26 -08:00
Maxime Beauchemin
4fec8c55ae Revert "Escape columns names for time grains - postgres (#3736)"
This reverts commit 814b70ffd8.
2017-11-14 21:25:41 -08:00
Riccardo Magliocchetti
0ed66c9e02 views: don't explode on test connection (#3828)
If we don't have the database saved.

Props to LittleQ (sqj597) for the fix.

Fix #3799
2017-11-11 21:45:54 -08:00
Maxime Beauchemin
21aee98622 0.20.5 2017-11-05 23:18:18 -08:00
Maxime Beauchemin
73a5884843 Merge branch 'master' into 0.20 2017-11-05 23:13:16 -08:00
Maxime Beauchemin
62d0db7457 v0.20.4 2017-10-11 21:04:54 -07:00
Maxime Beauchemin
68296b3d53 Merge branch 'master' into 0.20 2017-10-11 21:04:29 -07:00
Maxime Beauchemin
55af397020 v0.20.3 2017-10-06 00:55:40 -07:00
Maxime Beauchemin
0462b86581 Merge branch 'master' into 0.20 2017-10-06 00:54:46 -07:00
Maxime Beauchemin
3e3267066e v0.20.2 2017-10-06 00:46:21 -07:00
4 changed files with 31 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "superset",
"version": "0.20.1",
"version": "0.20.6",
"description": "Superset is a data exploration platform designed to be visual, intuitive, and interactive.",
"license": "Apache-2.0",
"directories": {

View File

@@ -214,14 +214,14 @@ class PostgresEngineSpec(BaseEngineSpec):
time_grains = (
Grain("Time Column", _('Time Column'), "{col}"),
Grain("second", _('second'), "DATE_TRUNC('second', \"{col}\")"),
Grain("minute", _('minute'), "DATE_TRUNC('minute', \"{col}\")"),
Grain("hour", _('hour'), "DATE_TRUNC('hour', \"{col}\")"),
Grain("day", _('day'), "DATE_TRUNC('day', \"{col}\")"),
Grain("week", _('week'), "DATE_TRUNC('week', \"{col}\")"),
Grain("month", _('month'), "DATE_TRUNC('month', \"{col}\")"),
Grain("quarter", _('quarter'), "DATE_TRUNC('quarter', \"{col}\")"),
Grain("year", _('year'), "DATE_TRUNC('year', \"{col}\")"),
Grain("second", _('second'), "DATE_TRUNC('second', {col})"),
Grain("minute", _('minute'), "DATE_TRUNC('minute', {col})"),
Grain("hour", _('hour'), "DATE_TRUNC('hour', {col})"),
Grain("day", _('day'), "DATE_TRUNC('day', {col})"),
Grain("week", _('week'), "DATE_TRUNC('week', {col})"),
Grain("month", _('month'), "DATE_TRUNC('month', {col})"),
Grain("quarter", _('quarter'), "DATE_TRUNC('quarter', {col})"),
Grain("year", _('year'), "DATE_TRUNC('year', {col})"),
)
@classmethod

View File

@@ -1444,12 +1444,12 @@ class Superset(BaseSupersetView):
# the password-masked uri was passed
# use the URI associated with this database
uri = database.sqlalchemy_uri_decrypted
url = make_url(uri)
db_engine = models.Database.get_db_engine_spec_for_backend(url.get_backend_name())
db_engine.patch()
uri = db_engine.get_uri_for_impersonation(uri, impersonate_user, username)
masked_url = database.get_password_masked_url_from_uri(uri)
masked_url = models.Database.get_password_masked_url_from_uri(uri)
logging.info("Superset.testconn(). Masked URL: {0}".format(masked_url))

View File

@@ -6,9 +6,10 @@ from __future__ import unicode_literals
import csv
import doctest
import io
import json
import logging
import io
import mock
import random
import unittest
@@ -300,6 +301,24 @@ class CoreTests(SupersetTestCase):
assert response.status_code == 200
assert response.headers['Content-Type'] == 'application/json'
def test_testconn_does_work_without_a_database(self, username='admin'):
self.login(username=username)
database = self.get_main_database(db.session)
data = json.dumps({
'uri': database.safe_sqlalchemy_uri(),
'name': '',
'impersonate_user': False
})
engine = mock.Mock()
engine.connect = mock.Mock()
engine.table_names = mock.Mock(return_value=[])
with mock.patch('superset.views.core.create_engine', return_value=engine):
response = self.client.post('/superset/testconn', data=data, content_type='application/json')
engine.table_names.assert_called_with()
assert response.status_code == 200
assert response.headers['Content-Type'] == 'application/json'
def test_custom_password_store(self):
database = self.get_main_database(db.session)
conn_pre = sqla.engine.url.make_url(database.sqlalchemy_uri_decrypted)