-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve engine spec discoverability #14204
feat: improve engine spec discoverability #14204
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14204 +/- ##
==========================================
- Coverage 76.13% 76.05% -0.09%
==========================================
Files 945 945
Lines 47927 47946 +19
Branches 5950 5950
==========================================
- Hits 36491 36464 -27
- Misses 11230 11276 +46
Partials 206 206
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! One question about automating population of the built-in specs, other than that LGTM!
setup.py
Outdated
entry_points={ | ||
"console_scripts": ["superset=superset.cli:superset",], | ||
"superset.db_engine_specs": [ | ||
"athena=superset.db_engine_specs.athena:AthenaEngineSpec", | ||
"bigquery=superset.db_engine_specs.bigquery:BigQueryEngineSpec", | ||
"clickhouse=superset.db_engine_specs.clickhouse:ClickHouseEngineSpec", | ||
"cockroachdb=superset.db_engine_specs.cockroachdb:CockroachDbEngineSpec", | ||
"crate=superset.db_engine_specs.crate:CrateEngineSpec", | ||
"databricks=superset.db_engine_specs.databricks:DatabricksHiveEngineSpec", | ||
"db2=superset.db_engine_specs.db2:Db2EngineSpec", | ||
"dremio=superset.db_engine_specs.dremio:DremioBaseEngineSpec", | ||
"drill=superset.db_engine_specs.drill:DrillEngineSpec", | ||
"druid=superset.db_engine_specs.druid:DruidEngineSpec", | ||
"elasticsearch=superset.db_engine_specs.elasticsearch:ElasticSearchEngineSpec", | ||
"odelasticsearch=superset.db_engine_specs.elasticsearch:OpenDistroEngineSpec", | ||
"exasol=superset.db_engine_specs.exasol:ExasolEngineSpec", | ||
"firebird=superset.db_engine_specs.firebird:FirebirdEngineSpec", | ||
"gsheets=superset.db_engine_specs.gsheets:GSheetsEngineSpec", | ||
"hana=superset.db_engine_specs.hana:HanaEngineSpec", | ||
"hive=superset.db_engine_specs.hive:HiveEngineSpec", | ||
"impala=superset.db_engine_specs.impala:ImpalaEngineSpec", | ||
"kylin=superset.db_engine_specs.kylin:KylinEngineSpec", | ||
"mssql=superset.db_engine_specs.mssql:MssqlEngineSpec", | ||
"mysql=superset.db_engine_specs.mysql:MySQLEngineSpec", | ||
"oracle=superset.db_engine_specs.oracle:OracleEngineSpec", | ||
"pinot=superset.db_engine_specs.pinot:PinotEngineSpec", | ||
"postgres=superset.db_engine_specs.postgres:PostgresEngineSpec", | ||
"presto=superset.db_engine_specs.presto:PrestoEngineSpec", | ||
"redshift=superset.db_engine_specs.redshift:RedshiftEngineSpec", | ||
"snowflake=superset.db_engine_specs.snowflake:SnowflakeEngineSpec", | ||
"solr=superset.db_engine_specs.solr:SolrEngineSpec", | ||
"sqlite=superset.db_engine_specs.sqlite:SqliteEngineSpec", | ||
"teradata=superset.db_engine_specs.teradata:TeradataEngineSpec", | ||
"trino=superset.db_engine_specs.trino:TrinoEngineSpec", | ||
"vertica=superset.db_engine_specs.vertica:VerticaEngineSpec", | ||
], | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to automate this part by iterating over modules in superset/db_engine_specs/*.py
and checking that they are issubclass
but not isinstance
of BaseEngineSpec
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
e9350a0
to
b90bf7e
Compare
b90bf7e
to
09c12de
Compare
09c12de
to
3276b3b
Compare
This reverts commit 13bf023.
try: | ||
engine_spec = ep.load() | ||
except Exception: # pylint: disable=broad-except | ||
logger.warning("Unable to load engine spec: %s", engine_spec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@betodealmeida there's a bug here. If line 68 throws an exception then engine_spec
isn't defined. Also adding documentation as to how to define external modules via entry_points
could be helpful.
* feat: improve engine spec discoverability * Address comments * Fix tests (cherry picked from commit 13bf023)
* feat: improve engine spec discoverability * Address comments * Fix tests
SUMMARY
This PR changes the mechanism we use to discover DB engine specs, switching to Python entry points. Using entry points is cleaner, and allows users to distribute new engine specs as packages separate from Superset.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
List of engines before:
And after:
The only difference is the absence of the base class:
'base': <class 'superset.db_engine_specs.base.BaseEngineSpec'>,
TEST PLAN
Tested Superset, everything works as expected.
ADDITIONAL INFORMATION