diff --git a/client/app/components/queries/schema-browser.js b/client/app/components/queries/schema-browser.js
index 34615aa590..ded89d09bc 100644
--- a/client/app/components/queries/schema-browser.js
+++ b/client/app/components/queries/schema-browser.js
@@ -3,6 +3,9 @@ import template from './schema-browser.html';
function SchemaBrowserCtrl($rootScope, $scope) {
'ngInject';
+ this.versionToggle = false;
+ this.versionFilter = 'abcdefghijklmnop';
+
this.showTable = (table) => {
table.collapsed = !table.collapsed;
$scope.$broadcast('vsRepeatTrigger');
@@ -21,6 +24,15 @@ function SchemaBrowserCtrl($rootScope, $scope) {
this.isEmpty = function isEmpty() {
return this.schema === undefined || this.schema.length === 0;
};
+ this.flipToggleVersionedTables = (versionToggle, toggleString) => {
+ if (versionToggle === false) {
+ this.versionToggle = true;
+ this.versionFilter = toggleString;
+ } else {
+ this.versionToggle = false;
+ this.versionFilter = 'abcdefghijklmnop';
+ }
+ };
this.itemSelected = ($event, hierarchy) => {
$rootScope.$broadcast('query-editor.command', 'paste', hierarchy.join('.'));
@@ -44,7 +56,9 @@ function SchemaBrowserCtrl($rootScope, $scope) {
const SchemaBrowser = {
bindings: {
schema: '<',
+ tabletogglestring: '<',
onRefresh: '&',
+ flipToggleVersionedTables: '&',
},
controller: SchemaBrowserCtrl,
template,
diff --git a/client/app/pages/queries/query.html b/client/app/pages/queries/query.html
index 05e1d5e910..77a0e8d0bd 100644
--- a/client/app/pages/queries/query.html
+++ b/client/app/pages/queries/query.html
@@ -96,7 +96,7 @@
-
+
diff --git a/redash/query_runner/__init__.py b/redash/query_runner/__init__.py
index c1d473cd1c..d923a22933 100644
--- a/redash/query_runner/__init__.py
+++ b/redash/query_runner/__init__.py
@@ -172,6 +172,12 @@ def configuration_schema(cls):
'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."
+ },
},
'secret': ['password'],
'order': ['url', 'username', 'password']
diff --git a/redash/query_runner/athena.py b/redash/query_runner/athena.py
index db13297caa..8d8e7b592d 100644
--- a/redash/query_runner/athena.py
+++ b/redash/query_runner/athena.py
@@ -84,6 +84,12 @@ def configuration_schema(cls):
'title': 'Athena Work Group',
'default': 'primary'
},
+ "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."
+ },
},
'required': ['region', 's3_staging_dir'],
'order': ['region', 's3_staging_dir', 'schema', 'work_group'],
diff --git a/redash/query_runner/axibase_tsd.py b/redash/query_runner/axibase_tsd.py
index d76de9ee29..ce768a6dc8 100644
--- a/redash/query_runner/axibase_tsd.py
+++ b/redash/query_runner/axibase_tsd.py
@@ -132,6 +132,12 @@ def configuration_schema(cls):
'trust_certificate': {
'type': 'boolean',
'title': 'Trust SSL Certificate'
+ },
+ "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."
}
},
'required': ['username', 'password', 'hostname', 'protocol', 'port'],
diff --git a/redash/query_runner/big_query.py b/redash/query_runner/big_query.py
index d85574372a..cbc4a3800f 100644
--- a/redash/query_runner/big_query.py
+++ b/redash/query_runner/big_query.py
@@ -126,6 +126,12 @@ def configuration_schema(cls):
'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."
}
},
'required': ['jsonKeyFile', 'projectId'],
diff --git a/redash/query_runner/cass.py b/redash/query_runner/cass.py
index 0f0c72ff66..11550dd181 100644
--- a/redash/query_runner/cass.py
+++ b/redash/query_runner/cass.py
@@ -61,6 +61,12 @@ def configuration_schema(cls):
'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."
}
},
'required': ['keyspace', 'host']
diff --git a/redash/query_runner/clickhouse.py b/redash/query_runner/clickhouse.py
index ebab7c83d3..58e1db7f00 100644
--- a/redash/query_runner/clickhouse.py
+++ b/redash/query_runner/clickhouse.py
@@ -36,6 +36,12 @@ def configuration_schema(cls):
"type": "number",
"title": "Request Timeout",
"default": 30
+ },
+ "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."
}
},
"required": ["dbname"],
diff --git a/redash/query_runner/dynamodb_sql.py b/redash/query_runner/dynamodb_sql.py
index 014d1bd5f6..af72d9c22f 100644
--- a/redash/query_runner/dynamodb_sql.py
+++ b/redash/query_runner/dynamodb_sql.py
@@ -47,6 +47,12 @@ def configuration_schema(cls):
},
"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."
}
},
"required": ["access_key", "secret_key"],
diff --git a/redash/query_runner/elasticsearch.py b/redash/query_runner/elasticsearch.py
index 22e08d3108..4d642ceb15 100644
--- a/redash/query_runner/elasticsearch.py
+++ b/redash/query_runner/elasticsearch.py
@@ -62,6 +62,12 @@ def configuration_schema(cls):
'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."
}
},
"order": ['server', 'basic_auth_user', 'basic_auth_password'],
diff --git a/redash/query_runner/google_analytics.py b/redash/query_runner/google_analytics.py
index 71be522015..117205a763 100644
--- a/redash/query_runner/google_analytics.py
+++ b/redash/query_runner/google_analytics.py
@@ -102,6 +102,12 @@ def configuration_schema(cls):
'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."
}
},
'required': ['jsonKeyFile'],
diff --git a/redash/query_runner/google_spreadsheets.py b/redash/query_runner/google_spreadsheets.py
index 5b144f4459..f5ca6a39e4 100644
--- a/redash/query_runner/google_spreadsheets.py
+++ b/redash/query_runner/google_spreadsheets.py
@@ -167,6 +167,12 @@ def configuration_schema(cls):
'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."
}
},
'required': ['jsonKeyFile'],
diff --git a/redash/query_runner/graphite.py b/redash/query_runner/graphite.py
index 1fb5ec1503..1ebdff1351 100644
--- a/redash/query_runner/graphite.py
+++ b/redash/query_runner/graphite.py
@@ -43,6 +43,12 @@ def configuration_schema(cls):
'verify': {
'type': 'boolean',
'title': 'Verify SSL certificate'
+ },
+ "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."
}
},
'required': ['url'],
diff --git a/redash/query_runner/hive_ds.py b/redash/query_runner/hive_ds.py
index 2107d0d0b9..ba31eb4b5c 100644
--- a/redash/query_runner/hive_ds.py
+++ b/redash/query_runner/hive_ds.py
@@ -55,6 +55,12 @@ def configuration_schema(cls):
"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."
+ }
},
"order": ["host", "port", "database", "username"],
"required": ["host"]
@@ -98,7 +104,6 @@ def _get_connection(self):
database=self.configuration.get('database', 'default'),
username=self.configuration.get('username', None),
)
-
return connection
def run_query(self, query, user):
diff --git a/redash/query_runner/impala_ds.py b/redash/query_runner/impala_ds.py
index 90b63fb3d1..8c0937a83e 100644
--- a/redash/query_runner/impala_ds.py
+++ b/redash/query_runner/impala_ds.py
@@ -64,6 +64,12 @@ def configuration_schema(cls):
},
"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."
}
},
"required": ["host"],
diff --git a/redash/query_runner/influx_db.py b/redash/query_runner/influx_db.py
index 47f3a4201f..aee41318b8 100644
--- a/redash/query_runner/influx_db.py
+++ b/redash/query_runner/influx_db.py
@@ -57,6 +57,12 @@ def configuration_schema(cls):
'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."
}
},
'required': ['url']
diff --git a/redash/query_runner/memsql_ds.py b/redash/query_runner/memsql_ds.py
index bbec2836d4..b573b529ff 100644
--- a/redash/query_runner/memsql_ds.py
+++ b/redash/query_runner/memsql_ds.py
@@ -55,6 +55,12 @@ def configuration_schema(cls):
},
"password": {
"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."
}
},
diff --git a/redash/query_runner/mongodb.py b/redash/query_runner/mongodb.py
index c6fbdc9760..34f44a0e4a 100644
--- a/redash/query_runner/mongodb.py
+++ b/redash/query_runner/mongodb.py
@@ -136,6 +136,12 @@ def configuration_schema(cls):
'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."
+ },
},
'required': ['connectionString', 'dbName']
}
diff --git a/redash/query_runner/mssql.py b/redash/query_runner/mssql.py
index c4b4fea1e0..041ea83052 100644
--- a/redash/query_runner/mssql.py
+++ b/redash/query_runner/mssql.py
@@ -60,6 +60,12 @@ def configuration_schema(cls):
"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."
}
},
"required": ["db"],
diff --git a/redash/query_runner/mysql.py b/redash/query_runner/mysql.py
index a6999b492e..0c99a0bdc0 100644
--- a/redash/query_runner/mysql.py
+++ b/redash/query_runner/mysql.py
@@ -60,6 +60,12 @@ def configuration_schema(cls):
'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."
}
},
"order": ['host', 'port', 'user', 'passwd', 'db'],
diff --git a/redash/query_runner/oracle.py b/redash/query_runner/oracle.py
index 10795dcbee..85400a1c8f 100644
--- a/redash/query_runner/oracle.py
+++ b/redash/query_runner/oracle.py
@@ -63,6 +63,12 @@ def configuration_schema(cls):
"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."
}
},
"required": ["servicename", "user", "password", "host", "port"],
diff --git a/redash/query_runner/pg.py b/redash/query_runner/pg.py
index df5dacfba1..c19d96e9d2 100644
--- a/redash/query_runner/pg.py
+++ b/redash/query_runner/pg.py
@@ -95,6 +95,12 @@ def configuration_schema(cls):
"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."
}
},
"order": ['host', 'port', 'user', 'password'],
diff --git a/redash/query_runner/presto.py b/redash/query_runner/presto.py
index 2966d1ccf9..c144bd9927 100644
--- a/redash/query_runner/presto.py
+++ b/redash/query_runner/presto.py
@@ -59,6 +59,12 @@ def configuration_schema(cls):
'password': {
'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."
+ },
},
'order': ['host', 'protocol', 'port', 'username', 'password', 'schema', 'catalog'],
'required': ['host']
diff --git a/redash/query_runner/python.py b/redash/query_runner/python.py
index 36209cd0ea..5458ee995d 100644
--- a/redash/query_runner/python.py
+++ b/redash/query_runner/python.py
@@ -55,6 +55,12 @@ def configuration_schema(cls):
},
'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."
}
},
}
diff --git a/redash/query_runner/salesforce.py b/redash/query_runner/salesforce.py
index b1187bef58..73527f68f9 100644
--- a/redash/query_runner/salesforce.py
+++ b/redash/query_runner/salesforce.py
@@ -81,6 +81,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Salesforce API Version",
"default": DEFAULT_API_VERSION
+ },
+ "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."
}
},
"required": ["username", "password", "token"],
diff --git a/redash/query_runner/script.py b/redash/query_runner/script.py
index 38e3ae62c5..1a4b80bdfd 100644
--- a/redash/query_runner/script.py
+++ b/redash/query_runner/script.py
@@ -49,6 +49,12 @@ def configuration_schema(cls):
'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."
}
},
'required': ['path']
diff --git a/redash/query_runner/snowflake.py b/redash/query_runner/snowflake.py
index 660e455e02..5854d7d55f 100644
--- a/redash/query_runner/snowflake.py
+++ b/redash/query_runner/snowflake.py
@@ -49,7 +49,13 @@ def configuration_schema(cls):
"region": {
"type": "string",
"default": "us-west"
- }
+ },
+ "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."
+ },
},
"order": ["account", "user", "password", "warehouse", "database", "region"],
"required": ["user", "password", "account", "database", "warehouse"],
diff --git a/redash/query_runner/sqlite.py b/redash/query_runner/sqlite.py
index c06cc024fe..51d251de97 100644
--- a/redash/query_runner/sqlite.py
+++ b/redash/query_runner/sqlite.py
@@ -21,6 +21,12 @@ def configuration_schema(cls):
"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."
}
},
"required": ["dbpath"],
diff --git a/redash/query_runner/treasuredata.py b/redash/query_runner/treasuredata.py
index 320f4e3457..24efcffe24 100644
--- a/redash/query_runner/treasuredata.py
+++ b/redash/query_runner/treasuredata.py
@@ -58,6 +58,12 @@ def configuration_schema(cls):
'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."
}
},
'required': ['apikey', 'db']
diff --git a/redash/query_runner/vertica.py b/redash/query_runner/vertica.py
index 08f4d616e1..58e7f524e5 100644
--- a/redash/query_runner/vertica.py
+++ b/redash/query_runner/vertica.py
@@ -60,6 +60,12 @@ def configuration_schema(cls):
"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."
+ },
},
'required': ['database'],
'order': ['host', 'port', 'user', 'password', 'database', 'read_timeout', 'connection_timeout'],
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 25ab3ef5c9..0546272cda 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -16,7 +16,7 @@ def test_interactive_new(self):
result = runner.invoke(
manager,
['ds', 'new'],
- input="test\n%s\n\n\nexample.com\n\n\ntestdb\n" % (pg_i,))
+ input="test\n%s\n\n\n\n\nexample.com\n\n\ntestdb\n" % (pg_i,))
self.assertFalse(result.exception)
self.assertEqual(result.exit_code, 0)
self.assertEqual(DataSource.query.count(), 1)