Skip to content

Commit

Permalink
feat(db-engine): Add support for Apache Solr (#12403)
Browse files Browse the repository at this point in the history
* [db engine] Add support for Apache Solr

* Fixing typo
  • Loading branch information
aadel authored and villebro committed Jan 15, 2021
1 parent a1f53fb commit 739ab14
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ Here's a list of some of the recommended packages.
| Apache Pinot | ``"apache-superset[pinot]"`` | ``pinot+http://CONTROLLER:5436/`` |
| | | ``query?server=http://CONTROLLER:5983/`` |
+------------------+-------------------------------------------------------------------+-------------------------------------------------+
| Apache Solr | ``pip install sqlalchemy-solr`` | ``solr://`` |
+------------------+---------------------------------------+-----------------------------------------------------------------------------+
| Apache Spark SQL | ``"apache-superset[hive]"`` | ``jdbc+hive://`` |
+------------------+-------------------------------------------------------------------+-------------------------------------------------+
| BigQuery | ``"apache-superset[bigquery]"`` | ``bigquery://`` |
Expand Down Expand Up @@ -685,6 +687,13 @@ You should then be able to connect to your BigQuery datasets.
To be able to upload data, e.g. sample data, the python library `pandas_gbq` is required.


Apache Solr
------------

The connection string for Apache Solr looks like this ::

solr://{username}:{password}@{host}:{port}/{server_path}/{collection}[/?use_ssl=true|false]

Elasticsearch
-------------

Expand Down
1 change: 1 addition & 0 deletions docs/src/pages/docs/Connecting to Databases/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ A list of some of the recommended packages.
|[Apache Impala](/docs/databases/impala)|```pip install impala```|```impala://{hostname}:{port}/{database}```|
|[Apache Kylin](/docs/databases/kylin)|```pip install kylinpy```|```kylin://<username>:<password>@<hostname>:<port>/<project>?<param1>=<value1>&<param2>=<value2>```|
|[Apache Pinot](/docs/databases/pinot)|```pip install pinotdb```|```pinot+http://CONTROLLER:5436/ query?server=http://CONTROLLER:5983/```|
|[Apache Solr](/docs/databases/solr)|```pip install sqlalchemy-solr```|```solr://{username}:{password}@{hostname}:{port}/{server_path}/{collection}```
|[Apache Spark SQL](/docs/databases/spark)|```pip install pyhive```|```hive://hive@{hostname}:{port}/{database}```
|[Azure MS SQL](/docs/databases/sqlserver)||```mssql+pymssql://UserName@presetSQL:TestPassword@presetSQL.database.windows.net:1433/TestSchema```
|[Big Query](/docs/databases/bigquery)|```pip install pybigquery```|```bigquery://{project_id}```|
Expand Down
18 changes: 18 additions & 0 deletions docs/src/pages/docs/Connecting to Databases/solr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Apache Solr
menu: Connecting to Databases
route: /docs/databases/solr
index: 10
version: 1
---

## Apache Solr

The [sqlalchemy-solr](https://pypi.org/project/sqlalchemy-solr/) library provides a
Python / SQLAlchemy interface to Apache Solr.

The connection string for Solr looks like this:

```
solr://{username}:{password}@{host}:{port}/{server_path}/{collection}[/?use_ssl=true|false]
```
2 changes: 1 addition & 1 deletion docs/src/pages/docs/Connecting to Databases/spark-sql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Apache Spark SQL
menu: Connecting to Databases
route: /docs/databases/spark-sql
index: 10
index: 11
version: 1
---

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def get_git_sha():
"dremio": ["sqlalchemy-dremio>=1.1.5, <1.2"],
"drill": ["sqlalchemy-drill==0.1.dev"],
"druid": ["pydruid>=0.6.1,<0.7"],
"solr": ["sqlalchemy-solr >= 0.2.0"],
"elasticsearch": ["elasticsearch-dbapi>=0.1.0, <0.2.0"],
"exasol": ["sqlalchemy-exasol>=2.1.0, <2.2"],
"excel": ["xlrd>=1.2.0, <1.3"],
Expand Down
34 changes: 34 additions & 0 deletions superset/db_engine_specs/solr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

from superset.db_engine_specs.base import BaseEngineSpec


class SolrEngineSpec(BaseEngineSpec): # pylint: disable=abstract-method
"""Engine spec for Apache Solr"""

engine = "solr"
engine_name = "Apache Solr"

time_groupby_inline = False
time_secondary_columns = False
allows_joins = False
allows_subqueries = False

_time_grain_expressions = {
None: "{col}",
}

0 comments on commit 739ab14

Please sign in to comment.