-
Notifications
You must be signed in to change notification settings - Fork 13.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
Improve examples & related tests #7773
Improve examples & related tests #7773
Conversation
c96cc2d
to
d12747a
Compare
c11a5f4
to
1b249b5
Compare
Codecov Report
@@ Coverage Diff @@
## master #7773 +/- ##
==========================================
- Coverage 65.82% 65.77% -0.05%
==========================================
Files 461 461
Lines 22105 22167 +62
Branches 2425 2425
==========================================
+ Hits 14551 14581 +30
- Misses 7433 7465 +32
Partials 121 121
Continue to review full report at Codecov.
|
8a5d82d
to
f01b8ff
Compare
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.
A big PR, so difficult to review thoroughly, but many important fixes/improvements and can be further refined later. I suggest merging this and dealing with possible regressions later.
"path_json": Text, | ||
}, | ||
index=False, | ||
) |
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.
Oh, one more thing; when I added csv import functionality for BigQuery, I refactored db_engine_specs
so that one can call db_engine_spec.df_to_sql(df, *kwargs)
in place of df.to_sql(*kwargs)
for engines that don't support df.to_sql()
. So to make this work universally here, one would write
database.db_engine_spec.df_to_sql(
tbl_name,
database.get_sqla_engine(),
if_exists="replace",
chunksize=500,
dtype={
"color": String(255),
"name": String(255),
"polyline": Text,
"path_json": Text,
},
index=False,
)
This doesn't necessarily have to be addressed in this PR; I can do that later, too, as I have a good test rig for that.
related to apache#7472, longer term we will generate the examples by exporting them into tarball as in apache#7472. In the meantime, we need this subset of the features: * allowing specifying an alternate database connection for examples * allowing a --only-metadata flag to `load_examples` to load only dashboard and chart definitions, no actual data is loaded
f01b8ff
to
146f599
Compare
135a85f
to
4ca819d
Compare
The bug was introduced in apache#7773 It uses filter by `cls.table_name == datasource_name`: https://github.com/apache/incubator-superset/pull/7773/files#diff-a8dd5ec8d8decda2e3c5571d1ec0cdb6R740 But export puts `slc.datasource.name` into exported json: https://github.com/apache/incubator-superset/pull/7773/files#diff-ceeb7eee8d573333109e0037299c9711L673 `slc.datasource.name` in case of `SqlaTable` is `"{}.{}".format(self.schema, self.table_name)`
The bug was introduced in #7773 It uses filter by `cls.table_name == datasource_name`: https://github.com/apache/incubator-superset/pull/7773/files#diff-a8dd5ec8d8decda2e3c5571d1ec0cdb6R740 But export puts `slc.datasource.name` into exported json: https://github.com/apache/incubator-superset/pull/7773/files#diff-ceeb7eee8d573333109e0037299c9711L673 `slc.datasource.name` in case of `SqlaTable` is `"{}.{}".format(self.schema, self.table_name)`
* [WiP] improve load_examples related to apache#7472, longer term we will generate the examples by exporting them into tarball as in apache#7472. In the meantime, we need this subset of the features: * allowing specifying an alternate database connection for examples * allowing a --only-metadata flag to `load_examples` to load only dashboard and chart definitions, no actual data is loaded * Improve logging * Rename data->examples * Load only if not exist * By default do not load, add a force flag * fix build * set published to true
The bug was introduced in apache#7773 It uses filter by `cls.table_name == datasource_name`: https://github.com/apache/incubator-superset/pull/7773/files#diff-a8dd5ec8d8decda2e3c5571d1ec0cdb6R740 But export puts `slc.datasource.name` into exported json: https://github.com/apache/incubator-superset/pull/7773/files#diff-ceeb7eee8d573333109e0037299c9711L673 `slc.datasource.name` in case of `SqlaTable` is `"{}.{}".format(self.schema, self.table_name)`
CATEGORY
Choose one
SUMMARY
related to #7478
This enables setting up an alternative URI for loading/storing/serving the examples data. New URI is defined with config key
SQLALCHEMY_EXAMPLES_URI
. If nothing not set explicitly, will default to point to the metadata database (SQLALCHEMY_DATABASE_URI
). This in turn adds a new default entry to theDatabase
model namedexamples
As a result, examples data tables can now be reused across Superset environments, and the tables don't get mixed in with the metadata database, leaving it cleaner.
Approach
load_examples
to load onlydashboard and chart definitions, no actual data is loaded
Longer term we will generate the examples by exporting
them into tarball as in #7472.