* [sql lab] a better approach at limiting queries
Currently there are two mechanisms that we use to enforce the row
limiting constraints, depending on the database engine:
1. use dbapi's `cursor.fetchmany()`
2. wrap the SQL into a limiting subquery
Method 1 isn't great as it can result in the database server storing
larger than required result sets in memory expecting another fetch
command while we know we don't need that.
Method 2 has a positive side of working with all database engines,
whether they use LIMIT, ROWNUM, TOP or whatever else since sqlalchemy
does the work as specified for the dialect. On the downside though
the query optimizer might not be able to optimize this as much as an
approach that doesn't use a subquery.
Since most modern DBs use the LIMIT syntax, this adds a regex approach
to modify the query and force a LIMIT clause without using a subquery
for the database that support this syntax and uses method 2 for all
others.
* Fixing build
* Fix lint
* Added more tests
* Fix tests
* Force lowercase column names for Snowflake and Oracle
* Force lowercase column names for Snowflake and Oracle
* Remove lowercasing of DB2 columns
* Remove DB2 lowercasing
* Fix test cases
* Add ISO duration to time grains
* Use ISO duration
* Remove debugging code
* Add module to yarn.lock
* Remove autolint
* Druid granularity as ISO
* Remove dangling comma
This fixes an issue with the newer Google's DBAPI library, which moved Row from google.cloud.bigquery._helper.Row to google.cloud.bigquery.Row, causing ImportError
* cast postgresql date_trunc() to timestamp without time zone to prevent pandas error
* fix formatting for flake8
* change cast to timezone conversion instead
Some valid sqlalchemy uri's return a URL object with database=None, which causes the following error:
```
2018-01-05 17:59:47,560:ERROR:root:argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/opt/incubator-superset/superset/sql_lab.py", line 186, in execute_sql
user_name=user_name,
File "/opt/incubator-superset/superset/utils.py", line 124, in __call__
return self.func(*args, **kwargs)
File "/opt/incubator-superset/superset/models/core.py", line 644, in get_sqla_engine
url = self.db_engine_spec.adjust_database_uri(url, schema)
File "/opt/incubator-superset/superset/db_engine_specs.py", line 505, in adjust_database_uri
if '/' in database:
TypeError: argument of type 'NoneType' is not iterable
```
This patch corrects that problem.
Since the latest pyhive, we don't need pythrifthiveapi as they ship with
the latest version.
There's actually a conflict between the new pyhive and pythrifthiveapi
and this fixes it.