diff --git a/client/app/assets/less/redash/query.less b/client/app/assets/less/redash/query.less
index 157c8b6823..3d1c5c394c 100644
--- a/client/app/assets/less/redash/query.less
+++ b/client/app/assets/less/redash/query.less
@@ -460,6 +460,7 @@ a.label-tag {
.datasource-small {
visibility: hidden;
+ display: none !important;
}
.query-fullscreen .query-metadata__mobile {
@@ -582,6 +583,11 @@ nav .rg-bottom {
display: none;
}
+ .datasource-small {
+ visibility: visible;
+ display: inline-block !important;
+ }
+
.query-fullscreen {
flex-direction: column;
overflow: hidden;
diff --git a/client/app/pages/data-sources/list.html b/client/app/pages/data-sources/list.html
index 56af90e071..fd23dfc516 100644
--- a/client/app/pages/data-sources/list.html
+++ b/client/app/pages/data-sources/list.html
@@ -9,7 +9,7 @@
{{ds.name}}
+
+
diff --git a/redash/models/__init__.py b/redash/models/__init__.py
index b060c797b8..98115a58bc 100644
--- a/redash/models/__init__.py
+++ b/redash/models/__init__.py
@@ -184,6 +184,8 @@ def add_group(self, group, view_only=False):
db.session.add(dsg)
return dsg
+ setattr(self, 'data_source_groups', dsg)
+
def remove_group(self, group):
DataSourceGroup.query.filter(
DataSourceGroup.group == group,
diff --git a/redash/query_runner/__init__.py b/redash/query_runner/__init__.py
index 2eb141286a..1162f181bf 100644
--- a/redash/query_runner/__init__.py
+++ b/redash/query_runner/__init__.py
@@ -54,6 +54,7 @@ class NotSupported(Exception):
class BaseQueryRunner(object):
noop_query = None
+ configuration_properties = None
def __init__(self, configuration):
self.syntax = 'sql'
@@ -79,6 +80,12 @@ def annotate_query(cls):
def configuration_schema(cls):
return {}
+ @classmethod
+ def add_configuration_property(cls, property, value):
+ if cls.configuration_properties is None:
+ raise NotImplementedError()
+ cls.configuration_properties[property] = value
+
def test_connection(self):
if self.noop_query is None:
raise NotImplementedError()
@@ -153,31 +160,36 @@ class BaseHTTPQueryRunner(BaseQueryRunner):
url_title = 'URL base path'
username_title = 'HTTP Basic Auth Username'
password_title = 'HTTP Basic Auth Password'
+ configuration_properties = {
+ 'url': {
+ 'type': 'string',
+ 'title': url_title,
+ },
+ 'username': {
+ 'type': 'string',
+ 'title': username_title,
+ },
+ 'password': {
+ 'type': 'string',
+ 'title': password_title,
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": (
+ "This string will be used to toggle visibility of "
+ "tables in the schema browser when editing a query "
+ "in order to remove non-useful tables from sight."
+ ),
+ },
+ }
@classmethod
def configuration_schema(cls):
schema = {
'type': 'object',
- 'properties': {
- 'url': {
- 'type': 'string',
- 'title': cls.url_title,
- },
- 'username': {
- 'type': 'string',
- 'title': cls.username_title,
- },
- 'password': {
- 'type': 'string',
- 'title': cls.password_title,
- },
- 'toggle_table_string': {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- },
- },
+ 'properties': cls.configuration_properties,
'secret': ['password'],
'order': ['url', 'username', 'password']
}
diff --git a/redash/query_runner/big_query.py b/redash/query_runner/big_query.py
index 1560964225..3a9ecb81e5 100644
--- a/redash/query_runner/big_query.py
+++ b/redash/query_runner/big_query.py
@@ -81,6 +81,47 @@ def _get_query_results(jobs, project_id, location, job_id, start_index):
class BigQuery(BaseQueryRunner):
noop_query = "SELECT 1"
+ configuration_properties = {
+ 'projectId': {
+ 'type': 'string',
+ 'title': 'Project ID'
+ },
+ 'jsonKeyFile': {
+ "type": "string",
+ 'title': 'JSON Key File'
+ },
+ 'totalMBytesProcessedLimit': {
+ "type": "number",
+ 'title': 'Scanned Data Limit (MB)'
+ },
+ 'userDefinedFunctionResourceUri': {
+ "type": "string",
+ 'title': 'UDF Source URIs (i.e. gs://bucket/date_utils.js, gs://bucket/string_utils.js )'
+ },
+ 'useStandardSql': {
+ "type": "boolean",
+ 'title': "Use Standard SQL (Beta)",
+ },
+ 'location': {
+ "type": "string",
+ "title": "Processing Location",
+ "default": "US",
+ },
+ 'loadSchema': {
+ "type": "boolean",
+ "title": "Load Schema"
+ },
+ 'maximumBillingTier': {
+ "type": "number",
+ "title": "Maximum Billing Tier"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def enabled(cls):
@@ -90,47 +131,7 @@ def enabled(cls):
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'projectId': {
- 'type': 'string',
- 'title': 'Project ID'
- },
- 'jsonKeyFile': {
- "type": "string",
- 'title': 'JSON Key File'
- },
- 'totalMBytesProcessedLimit': {
- "type": "number",
- 'title': 'Scanned Data Limit (MB)'
- },
- 'userDefinedFunctionResourceUri': {
- "type": "string",
- 'title': 'UDF Source URIs (i.e. gs://bucket/date_utils.js, gs://bucket/string_utils.js )'
- },
- 'useStandardSql': {
- "type": "boolean",
- 'title': "Use Standard SQL",
- "default": True,
- },
- 'location': {
- "type": "string",
- "title": "Processing Location",
- },
- 'loadSchema': {
- "type": "boolean",
- "title": "Load Schema"
- },
- 'maximumBillingTier': {
- "type": "number",
- "title": "Maximum Billing Tier"
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties,
'required': ['jsonKeyFile', 'projectId'],
"order": ['projectId', 'jsonKeyFile', 'loadSchema', 'useStandardSql', 'location', 'totalMBytesProcessedLimit', 'maximumBillingTier', 'userDefinedFunctionResourceUri'],
'secret': ['jsonKeyFile']
diff --git a/redash/query_runner/cass.py b/redash/query_runner/cass.py
index 11550dd181..e59f8d0ce2 100644
--- a/redash/query_runner/cass.py
+++ b/redash/query_runner/cass.py
@@ -23,6 +23,43 @@ def default(self, o):
class Cassandra(BaseQueryRunner):
noop_query = "SELECT dateof(now()) FROM system.local"
+ configuration_properties = {
+ 'host': {
+ 'type': 'string',
+ },
+ 'port': {
+ 'type': 'number',
+ 'default': 9042,
+ },
+ 'keyspace': {
+ 'type': 'string',
+ 'title': 'Keyspace name'
+ },
+ 'username': {
+ 'type': 'string',
+ 'title': 'Username'
+ },
+ 'password': {
+ 'type': 'string',
+ 'title': 'Password'
+ },
+ 'protocol': {
+ 'type': 'number',
+ 'title': 'Protocol Version',
+ 'default': 3
+ },
+ 'timeout': {
+ 'type': 'number',
+ 'title': 'Timeout',
+ 'default': 10
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def enabled(cls):
@@ -32,43 +69,7 @@ def enabled(cls):
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'host': {
- 'type': 'string',
- },
- 'port': {
- 'type': 'number',
- 'default': 9042,
- },
- 'keyspace': {
- 'type': 'string',
- 'title': 'Keyspace name'
- },
- 'username': {
- 'type': 'string',
- 'title': 'Username'
- },
- 'password': {
- 'type': 'string',
- 'title': 'Password'
- },
- 'protocol': {
- 'type': 'number',
- 'title': 'Protocol Version',
- 'default': 3
- },
- 'timeout': {
- 'type': 'number',
- 'title': 'Timeout',
- 'default': 10
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties,
'required': ['keyspace', 'host']
}
diff --git a/redash/query_runner/dynamodb_sql.py b/redash/query_runner/dynamodb_sql.py
index 32cf84669d..3623e6a6f0 100644
--- a/redash/query_runner/dynamodb_sql.py
+++ b/redash/query_runner/dynamodb_sql.py
@@ -32,28 +32,31 @@
class DynamoDBSQL(BaseSQLQueryRunner):
+ noop_query = "SELECT 1"
+ configuration_properties = {
+ "region": {
+ "type": "string",
+ "default": "us-east-1"
+ },
+ "access_key": {
+ "type": "string",
+ },
+ "secret_key": {
+ "type": "string",
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
+
@classmethod
def configuration_schema(cls):
return {
"type": "object",
- "properties": {
- "region": {
- "type": "string",
- "default": "us-east-1"
- },
- "access_key": {
- "type": "string",
- },
- "secret_key": {
- "type": "string",
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ "properties": cls.configuration_properties,
"required": ["access_key", "secret_key"],
"secret": ["secret_key"]
}
diff --git a/redash/query_runner/elasticsearch.py b/redash/query_runner/elasticsearch.py
index 4d642ceb15..3ceefee267 100644
--- a/redash/query_runner/elasticsearch.py
+++ b/redash/query_runner/elasticsearch.py
@@ -45,31 +45,32 @@
class BaseElasticSearch(BaseQueryRunner):
DEBUG_ENABLED = False
+ configuration_properties = {
+ 'server': {
+ 'type': 'string',
+ 'title': 'Base URL'
+ },
+ 'basic_auth_user': {
+ 'type': 'string',
+ 'title': 'Basic Auth User'
+ },
+ 'basic_auth_password': {
+ 'type': 'string',
+ 'title': 'Basic Auth Password'
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'server': {
- 'type': 'string',
- 'title': 'Base URL'
- },
- 'basic_auth_user': {
- 'type': 'string',
- 'title': 'Basic Auth User'
- },
- 'basic_auth_password': {
- 'type': 'string',
- 'title': 'Basic Auth Password'
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties,
"order": ['server', 'basic_auth_user', 'basic_auth_password'],
"secret": ["basic_auth_password"],
"required": ["server"]
diff --git a/redash/query_runner/google_spreadsheets.py b/redash/query_runner/google_spreadsheets.py
index d6bb9259cf..4616fd4beb 100644
--- a/redash/query_runner/google_spreadsheets.py
+++ b/redash/query_runner/google_spreadsheets.py
@@ -124,6 +124,19 @@ def request(self, *args, **kwargs):
class GoogleSpreadsheet(BaseQueryRunner):
+ configuration_properties = {
+ 'jsonKeyFile': {
+ "type": "string",
+ 'title': 'JSON Key File'
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
+
def __init__(self, configuration):
super(GoogleSpreadsheet, self).__init__(configuration)
self.syntax = 'custom'
@@ -144,18 +157,7 @@ def enabled(cls):
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'jsonKeyFile': {
- "type": "string",
- 'title': 'JSON Key File'
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties,
'required': ['jsonKeyFile'],
'secret': ['jsonKeyFile']
}
diff --git a/redash/query_runner/graphite.py b/redash/query_runner/graphite.py
index adc0826052..62f23bc361 100644
--- a/redash/query_runner/graphite.py
+++ b/redash/query_runner/graphite.py
@@ -49,7 +49,7 @@ def configuration_schema(cls):
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
+ },
},
'required': ['url'],
'secret': ['password']
diff --git a/redash/query_runner/hive_ds.py b/redash/query_runner/hive_ds.py
index 6d8ec67c3e..cab6ff1d96 100644
--- a/redash/query_runner/hive_ds.py
+++ b/redash/query_runner/hive_ds.py
@@ -37,31 +37,32 @@
class Hive(BaseSQLQueryRunner):
noop_query = "SELECT 1"
+ configuration_properties = {
+ "host": {
+ "type": "string"
+ },
+ "port": {
+ "type": "number"
+ },
+ "database": {
+ "type": "string"
+ },
+ "username": {
+ "type": "string"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
"type": "object",
- "properties": {
- "host": {
- "type": "string"
- },
- "port": {
- "type": "number"
- },
- "database": {
- "type": "string"
- },
- "username": {
- "type": "string"
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ "properties": cls.configuration_properties,
"order": ["host", "port", "database", "username"],
"required": ["host"]
}
diff --git a/redash/query_runner/impala_ds.py b/redash/query_runner/impala_ds.py
index b57bb0b7e6..111d39b4ae 100644
--- a/redash/query_runner/impala_ds.py
+++ b/redash/query_runner/impala_ds.py
@@ -34,44 +34,45 @@
class Impala(BaseSQLQueryRunner):
noop_query = "show schemas"
+ configuration_properties = {
+ "host": {
+ "type": "string"
+ },
+ "port": {
+ "type": "number"
+ },
+ "protocol": {
+ "type": "string",
+ "title": "Please specify beeswax or hiveserver2"
+ },
+ "database": {
+ "type": "string"
+ },
+ "use_ldap": {
+ "type": "boolean"
+ },
+ "ldap_user": {
+ "type": "string"
+ },
+ "ldap_password": {
+ "type": "string"
+ },
+ "timeout": {
+ "type": "number"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
"type": "object",
- "properties": {
- "host": {
- "type": "string"
- },
- "port": {
- "type": "number"
- },
- "protocol": {
- "type": "string",
- "title": "Please specify beeswax or hiveserver2"
- },
- "database": {
- "type": "string"
- },
- "use_ldap": {
- "type": "boolean"
- },
- "ldap_user": {
- "type": "string"
- },
- "ldap_password": {
- "type": "string"
- },
- "timeout": {
- "type": "number"
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ "properties": cls.configuration_properties,
"required": ["host"],
"secret": ["ldap_password"]
}
diff --git a/redash/query_runner/influx_db.py b/redash/query_runner/influx_db.py
index aee41318b8..d3351312c1 100644
--- a/redash/query_runner/influx_db.py
+++ b/redash/query_runner/influx_db.py
@@ -49,22 +49,23 @@ def _transform_result(results):
class InfluxDB(BaseQueryRunner):
noop_query = "show measurements limit 1"
+ configuration_properties = {
+ 'url': {
+ 'type': 'string'
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'url': {
- 'type': 'string'
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties,
'required': ['url']
}
diff --git a/redash/query_runner/mongodb.py b/redash/query_runner/mongodb.py
index 310cdafeeb..586ea28af1 100644
--- a/redash/query_runner/mongodb.py
+++ b/redash/query_runner/mongodb.py
@@ -117,30 +117,32 @@ def parse_results(results):
class MongoDB(BaseQueryRunner):
+ configuration_properties = {
+ 'connectionString': {
+ 'type': 'string',
+ 'title': 'Connection String'
+ },
+ 'dbName': {
+ 'type': 'string',
+ 'title': "Database Name"
+ },
+ 'replicaSetName': {
+ 'type': 'string',
+ 'title': 'Replica Set Name'
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
+
@classmethod
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'connectionString': {
- 'type': 'string',
- 'title': 'Connection String'
- },
- 'dbName': {
- 'type': 'string',
- 'title': "Database Name"
- },
- 'replicaSetName': {
- 'type': 'string',
- 'title': 'Replica Set Name'
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- },
- },
+ 'properties': cls.configuration_properties,
'required': ['connectionString', 'dbName']
}
diff --git a/redash/query_runner/mssql.py b/redash/query_runner/mssql.py
index 0cf25567a9..b2c188d112 100644
--- a/redash/query_runner/mssql.py
+++ b/redash/query_runner/mssql.py
@@ -27,47 +27,48 @@
class SqlServer(BaseSQLQueryRunner):
noop_query = "SELECT 1"
+ configuration_properties = {
+ "user": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string"
+ },
+ "server": {
+ "type": "string",
+ "default": "127.0.0.1"
+ },
+ "port": {
+ "type": "number",
+ "default": 1433
+ },
+ "tds_version": {
+ "type": "string",
+ "default": "7.0",
+ "title": "TDS Version"
+ },
+ "charset": {
+ "type": "string",
+ "default": "UTF-8",
+ "title": "Character Set"
+ },
+ "db": {
+ "type": "string",
+ "title": "Database Name"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
"type": "object",
- "properties": {
- "user": {
- "type": "string"
- },
- "password": {
- "type": "string"
- },
- "server": {
- "type": "string",
- "default": "127.0.0.1"
- },
- "port": {
- "type": "number",
- "default": 1433
- },
- "tds_version": {
- "type": "string",
- "default": "7.0",
- "title": "TDS Version"
- },
- "charset": {
- "type": "string",
- "default": "UTF-8",
- "title": "Character Set"
- },
- "db": {
- "type": "string",
- "title": "Database Name"
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ "properties": cls.configuration_properties,
"required": ["db"],
"secret": ["password"]
}
diff --git a/redash/query_runner/mysql.py b/redash/query_runner/mysql.py
index 3f5f9d310b..18ce41f72a 100644
--- a/redash/query_runner/mysql.py
+++ b/redash/query_runner/mysql.py
@@ -28,6 +28,33 @@
class Mysql(BaseSQLQueryRunner):
noop_query = "SELECT 1"
+ configuration_properties = {
+ 'host': {
+ 'type': 'string',
+ 'default': '127.0.0.1'
+ },
+ 'user': {
+ 'type': 'string'
+ },
+ 'passwd': {
+ 'type': 'string',
+ 'title': 'Password'
+ },
+ 'db': {
+ 'type': 'string',
+ 'title': 'Database name'
+ },
+ 'port': {
+ 'type': 'number',
+ 'default': 3306,
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
@@ -35,33 +62,7 @@ def configuration_schema(cls):
schema = {
'type': 'object',
- 'properties': {
- 'host': {
- 'type': 'string',
- 'default': '127.0.0.1'
- },
- 'user': {
- 'type': 'string'
- },
- 'passwd': {
- 'type': 'string',
- 'title': 'Password'
- },
- 'db': {
- 'type': 'string',
- 'title': 'Database name'
- },
- 'port': {
- 'type': 'number',
- 'default': 3306,
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties,
"order": ['host', 'port', 'user', 'passwd', 'db'],
'required': ['db'],
'secret': ['passwd']
@@ -84,7 +85,7 @@ def configuration_schema(cls):
'ssl_key': {
'type': 'string',
'title': 'Path to private key file (SSL)'
- }
+ },
})
return schema
diff --git a/redash/query_runner/oracle.py b/redash/query_runner/oracle.py
index 8979ebb11b..7acb9f0038 100644
--- a/redash/query_runner/oracle.py
+++ b/redash/query_runner/oracle.py
@@ -29,8 +29,33 @@
logger = logging.getLogger(__name__)
+
class Oracle(BaseSQLQueryRunner):
noop_query = "SELECT 1 FROM dual"
+ configuration_properties = {
+ "user": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string"
+ },
+ "host": {
+ "type": "string"
+ },
+ "port": {
+ "type": "number"
+ },
+ "servicename": {
+ "type": "string",
+ "title": "DSN Service Name"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def get_col_type(cls, col_type, scale):
@@ -47,30 +72,7 @@ def enabled(cls):
def configuration_schema(cls):
return {
"type": "object",
- "properties": {
- "user": {
- "type": "string"
- },
- "password": {
- "type": "string"
- },
- "host": {
- "type": "string"
- },
- "port": {
- "type": "number"
- },
- "servicename": {
- "type": "string",
- "title": "DSN Service Name"
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ "properties": cls.configuration_properties,
"required": ["servicename", "user", "password", "host", "port"],
"secret": ["password"]
}
diff --git a/redash/query_runner/pg.py b/redash/query_runner/pg.py
index 03ca0ef833..bcd483d236 100644
--- a/redash/query_runner/pg.py
+++ b/redash/query_runner/pg.py
@@ -67,42 +67,43 @@ def _wait(conn, timeout=None):
class PostgreSQL(BaseSQLQueryRunner):
noop_query = "SELECT 1"
+ configuration_properties = {
+ "user": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string"
+ },
+ "host": {
+ "type": "string",
+ "default": "127.0.0.1"
+ },
+ "port": {
+ "type": "number",
+ "default": 5432
+ },
+ "dbname": {
+ "type": "string",
+ "title": "Database Name"
+ },
+ "sslmode": {
+ "type": "string",
+ "title": "SSL Mode",
+ "default": "prefer"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
"type": "object",
- "properties": {
- "user": {
- "type": "string"
- },
- "password": {
- "type": "string"
- },
- "host": {
- "type": "string",
- "default": "127.0.0.1"
- },
- "port": {
- "type": "number",
- "default": 5432
- },
- "dbname": {
- "type": "string",
- "title": "Database Name"
- },
- "sslmode": {
- "type": "string",
- "title": "SSL Mode",
- "default": "prefer"
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ "properties": cls.configuration_properties,
"order": ['host', 'port', 'user', 'password'],
"required": ["dbname"],
"secret": ["password"]
@@ -216,6 +217,36 @@ def run_query(self, query, user):
class Redshift(PostgreSQL):
+ configuration_properties = {
+ "user": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string"
+ },
+ "host": {
+ "type": "string"
+ },
+ "port": {
+ "type": "number"
+ },
+ "dbname": {
+ "type": "string",
+ "title": "Database Name"
+ },
+ "sslmode": {
+ "type": "string",
+ "title": "SSL Mode",
+ "default": "prefer"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
+
@classmethod
def type(cls):
return "redshift"
@@ -239,29 +270,7 @@ def configuration_schema(cls):
return {
"type": "object",
- "properties": {
- "user": {
- "type": "string"
- },
- "password": {
- "type": "string"
- },
- "host": {
- "type": "string"
- },
- "port": {
- "type": "number"
- },
- "dbname": {
- "type": "string",
- "title": "Database Name"
- },
- "sslmode": {
- "type": "string",
- "title": "SSL Mode",
- "default": "prefer"
- }
- },
+ "properties": cls.configuration_properties,
"order": ['host', 'port', 'user', 'password'],
"required": ["dbname", "user", "password", "host", "port"],
"secret": ["password"]
diff --git a/redash/query_runner/presto.py b/redash/query_runner/presto.py
index 5d84b1e803..2175072c7d 100644
--- a/redash/query_runner/presto.py
+++ b/redash/query_runner/presto.py
@@ -31,38 +31,35 @@
class Presto(BaseQueryRunner):
noop_query = 'SHOW TABLES'
+ configuration_properties = {
+ 'host': {
+ 'type': 'string'
+ },
+ 'port': {
+ 'type': 'number'
+ },
+ 'schema': {
+ 'type': 'string'
+ },
+ 'catalog': {
+ 'type': 'string'
+ },
+ 'username': {
+ 'type': 'string'
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'host': {
- 'type': 'string'
- },
- 'protocol': {
- 'type': 'string',
- 'default': 'http'
- },
- 'port': {
- 'type': 'number'
- },
- 'schema': {
- 'type': 'string'
- },
- 'catalog': {
- 'type': 'string'
- },
- 'username': {
- 'type': 'string'
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- },
- },
+ 'properties': cls.configuration_properties,
'order': ['host', 'protocol', 'port', 'username', 'schema', 'catalog'],
'required': ['host']
}
diff --git a/redash/query_runner/python.py b/redash/query_runner/python.py
index 4fdf0de626..9b29128c2f 100644
--- a/redash/query_runner/python.py
+++ b/redash/query_runner/python.py
@@ -44,25 +44,27 @@ class Python(BaseQueryRunner):
'tuple', 'set', 'list', 'dict', 'bool',
)
+ configuration_properties = {
+ 'allowedImportModules': {
+ 'type': 'string',
+ 'title': 'Modules to import prior to running the script'
+ },
+ 'additionalModulesPaths': {
+ 'type': 'string'
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
+
@classmethod
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'allowedImportModules': {
- 'type': 'string',
- 'title': 'Modules to import prior to running the script'
- },
- 'additionalModulesPaths': {
- 'type': 'string'
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties
}
@classmethod
diff --git a/redash/query_runner/script.py b/redash/query_runner/script.py
index 1a4b80bdfd..808d1024a2 100644
--- a/redash/query_runner/script.py
+++ b/redash/query_runner/script.py
@@ -29,6 +29,23 @@ def run_script(script, shell):
class Script(BaseQueryRunner):
+ configuration_properties = {
+ 'path': {
+ 'type': 'string',
+ 'title': 'Scripts path'
+ },
+ 'shell': {
+ 'type': 'boolean',
+ 'title': 'Execute command through the shell'
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
+
@classmethod
def annotate_query(cls):
return False
@@ -41,22 +58,7 @@ def enabled(cls):
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'path': {
- 'type': 'string',
- 'title': 'Scripts path'
- },
- 'shell': {
- 'type': 'boolean',
- 'title': 'Execute command through the shell'
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties,
'required': ['path']
}
diff --git a/redash/query_runner/sqlite.py b/redash/query_runner/sqlite.py
index 9f02315e60..79c4f9c3e4 100644
--- a/redash/query_runner/sqlite.py
+++ b/redash/query_runner/sqlite.py
@@ -12,23 +12,24 @@
class Sqlite(BaseSQLQueryRunner):
noop_query = "pragma quick_check"
+ configuration_properties = {
+ "dbpath": {
+ "type": "string",
+ "title": "Database Path"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
"type": "object",
- "properties": {
- "dbpath": {
- "type": "string",
- "title": "Database Path"
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ "properties": cls.configuration_properties,
"required": ["dbpath"],
}
diff --git a/redash/query_runner/treasuredata.py b/redash/query_runner/treasuredata.py
index 52ee2029c1..5321706801 100644
--- a/redash/query_runner/treasuredata.py
+++ b/redash/query_runner/treasuredata.py
@@ -35,37 +35,38 @@
class TreasureData(BaseQueryRunner):
noop_query = "SELECT 1"
+ configuration_properties = {
+ 'endpoint': {
+ 'type': 'string'
+ },
+ 'apikey': {
+ 'type': 'string'
+ },
+ 'type': {
+ 'type': 'string'
+ },
+ 'db': {
+ 'type': 'string',
+ 'title': 'Database Name'
+ },
+ 'get_schema': {
+ 'type': 'boolean',
+ 'title': 'Auto Schema Retrieval',
+ 'default': False
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'endpoint': {
- 'type': 'string'
- },
- 'apikey': {
- 'type': 'string'
- },
- 'type': {
- 'type': 'string'
- },
- 'db': {
- 'type': 'string',
- 'title': 'Database Name'
- },
- 'get_schema': {
- 'type': 'boolean',
- 'title': 'Auto Schema Retrieval',
- 'default': False
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- }
- },
+ 'properties': cls.configuration_properties,
'required': ['apikey','db']
}
diff --git a/redash/query_runner/vertica.py b/redash/query_runner/vertica.py
index 92633eb23e..6bffece1ea 100644
--- a/redash/query_runner/vertica.py
+++ b/redash/query_runner/vertica.py
@@ -29,44 +29,45 @@
class Vertica(BaseSQLQueryRunner):
noop_query = "SELECT 1"
+ configuration_properties = {
+ 'host': {
+ 'type': 'string'
+ },
+ 'user': {
+ 'type': 'string'
+ },
+ 'password': {
+ 'type': 'string',
+ 'title': 'Password'
+ },
+ 'database': {
+ 'type': 'string',
+ 'title': 'Database name'
+ },
+ "port": {
+ "type": "number"
+ },
+ "read_timeout": {
+ "type": "number",
+ "title": "Read Timeout"
+ },
+ "connection_timeout": {
+ "type": "number",
+ "title": "Connection Timeout"
+ },
+ "toggle_table_string": {
+ "type": "string",
+ "title": "Toggle Table String",
+ "default": "_v",
+ "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
+ },
+ }
@classmethod
def configuration_schema(cls):
return {
'type': 'object',
- 'properties': {
- 'host': {
- 'type': 'string'
- },
- 'user': {
- 'type': 'string'
- },
- 'password': {
- 'type': 'string',
- 'title': 'Password'
- },
- 'database': {
- 'type': 'string',
- 'title': 'Database name'
- },
- "port": {
- "type": "number"
- },
- "read_timeout": {
- "type": "number",
- "title": "Read Timeout"
- },
- "connection_timeout": {
- "type": "number",
- "title": "Connection Timeout"
- },
- "toggle_table_string": {
- "type": "string",
- "title": "Toggle Table String",
- "default": "_v",
- "info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
- },
- },
+ 'properties': cls.configuration_properties,
'required': ['database'],
'order': ['host', 'port', 'user', 'password', 'database', 'read_timeout', 'connection_timeout'],
'secret': ['password']
diff --git a/requirements.txt b/requirements.txt
index 7b46ed1a01..5c8eb4effb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -61,4 +61,4 @@ disposable-email-domains
# It is not included by default because of the GPL license conflict.
# ldap3==2.2.4
gevent==1.4.0
-redash-stmo>=2018.8.1
+redash-stmo>=2018.9.1
diff --git a/tests/handlers/test_data_sources.py b/tests/handlers/test_data_sources.py
index f07a2b3719..4590056fd4 100644
--- a/tests/handlers/test_data_sources.py
+++ b/tests/handlers/test_data_sources.py
@@ -60,7 +60,8 @@ def test_updates_data_source(self):
new_name = 'New Name'
new_options = {"dbname": "newdb"}
rv = self.make_request('post', self.path,
- data={'name': new_name, 'type': 'pg', 'options': new_options},
+ data={'name': new_name, 'type': 'pg', 'options': new_options,
+ 'doc_url': None},
user=admin)
self.assertEqual(rv.status_code, 200)
@@ -101,7 +102,9 @@ def test_returns_400_when_configuration_invalid(self):
def test_creates_data_source(self):
admin = self.factory.create_admin()
rv = self.make_request('post', '/api/data_sources',
- data={'name': 'DS 1', 'type': 'pg', 'options': {"dbname": "redash"}}, user=admin)
+ data={'name': 'DS 1', 'type': 'pg',
+ 'options': {"dbname": "redash"},
+ 'doc_url': None}, user=admin)
self.assertEqual(rv.status_code, 200)