mirror of
https://github.com/apache/superset.git
synced 2026-04-28 12:34:23 +00:00
Compare commits
10 Commits
fix-docker
...
0.20.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f554c7f6a6 | ||
|
|
4fec8c55ae | ||
|
|
0ed66c9e02 | ||
|
|
21aee98622 | ||
|
|
73a5884843 | ||
|
|
62d0db7457 | ||
|
|
68296b3d53 | ||
|
|
55af397020 | ||
|
|
0462b86581 | ||
|
|
3e3267066e |
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user