This problem especially happens with pinot when you select two metrics
with different aliases but same function. For example, effectively the
sql like 'select type, count(*) as one, count(*) as two from bar group
by type'. In such a case, pinot will return two columns, both named
count_star.
So when we try to do a df['count_star'], the result is a Dataframe and
not a Series. This causes a KeyError in the get_df method.
So we push the DB specific label mutation inside get_df before we do any
other mutation.
* Force quotes on non-expression time grains on postgres
* Change to or semantics
* Return lower case column name as unmutated
* Add testcases for postgres time grains
* Make expression MixedCase
* Merge dataframe and column name mutation logic, add flag for disabling column aliases and add column name length checking
* Remove custome mutate_label from oracle spec
* Move hashing from mutate_label() to make_label_compatible()
* Remove empty line
* Make label mutating and truncating more robust
* Rename variables and make proposed changes from review
* Always execute labels_expected codepath
* Fix linting error
* Add comments and fix subquery errors
* Refine column compatibility
* Simplify label assignment
* Add unit tests for BQ and Oracle
* Linting
* Adding dropdown to DatasourceControl and ability to change datasource
* Style fixes
* Adding unit tests for datasource/get endpoint
* Fixing issue with dropdown overflow and style changes
* Fixing issues rebasing metadata button and fixing sort for datasource with no name
* Add show metadata button back to the explore view
- Add the show metadta button, accidentally removed from PR #6046, back to the explore view
- Remove dead code that is no longer reachable from DataSourceModal.jsx.
* Adding additional code back to make the button function and remove more dead code.
The problem with the previous solution was that the `npm ci` command
nuke the `node_modules` folder, including the `.cache` that was used by
default. By moving the cache out of `node_modules` we get to both run
`npm ci` and accelerate `TerserPlugin`
* Relayout SQL Editor
- Refactor SQL editor to remove usage of bootstrap col, row and collapse to simplify the layout
- Replace the react-split-pane libraray with react-split to allow custom styling of the gutter area without sacrifice correctness of the ace editor height calculation
- Rewrite the left pane animation via plain css transition and animate it to slide in and out
- General code and css clean up
* Smooth out the visual transition during dragging
(cherry picked from commit 19f82b729c7a939f12b1c5da6022c0fd76fa3ec9)
* Adjust how the height of the south pane is computed, fixing cypress tests
* Update webpack config to facilitate debugging charts via symlink and update babel plugin version
* update @superset-ui-legacy version
* update packages
* Speed up CI by caching TersetPlugin cache
This should accelerate the `npm run build` part of the build by ~5
minutes or so I believe.
* targeting terser-webpack-plugin/
* Make the target path of the superset logo configuable
There is a need to have the target path of the logo go to different places in different installations of superset. The PR makes the target path (after `/superset`) configurable via the LOGO_TARGET_PATH configuration key and sets the default to the existing `/profile/{{ current_user.username }}/`
* addressing pr comments
This PR introduces the backend changes for a tagging system for Superset, allowing dashboards, charts and queries to be tagged. It also allows searching for a given tag, and will be the basis for a new landing page (see #5327).
# Implicit tags
Dashboard, chart and (saved) queries have implicit tags related to their owners, types and favorites. For example, all objects owned by the admin have the tag `owner:1`. All charts have the tag `type:chart`. Objects favorited by the admin have the tag `favorited_by:1`.
These tags are automatically added by a migration script, and kept in sync through SQLAlchemy event listeners. They are currently not surfaced to the user, but can be searched for. For example, it's possible to search for `owner:1` in the welcome page to see all objects owned by the admin, or even search for `owner:{{ current_user_id() }}`.
Summary: Added limited support for visualizations with Pinot via
Sqlalchemy.
Pinot QL (PQL) is a bit weird and limited, and this patch hacks superset to
deal with that weirdness:
1. Pinot's grouping by time is best done as a long epoch. Grouping by a
time string is really slow and times out.
2. Pinot's response does not respect column aliases. So columns are not
named what they are expected to. So we remember the given column aliases
and then stamp them back onto the dataframe
3. Pinot's Json rest call does not return the output types. Instead
everything is cast to string. So when grouping by time, the group key
is integral and has to be treated specially when casting back to the
dataframe __timestamp column.
4. Finally, pinot does support grouping by on expressions. But those
expressions cannot then appear on the select clause. They are returned
regardless in the response. ie, 'select foo, count(*) from bar group by
foo' is okay, but 'select expr(foo), count(*) from bar group by
expr(foo)' ain't. One must use 'select count(*) from bar group by
expr(foo)'.
I also fixed a couple of things that looked like bugs to me: for
example, the row-ordering-limit should come at the end always.
Test Plan: Tested with the modified pinotdb sqlalchemy driver and an
internal pinot cluster. The pinotdb driver changes are in
https://github.com/agrawaldevesh/pinot-dbapi.
Pinot does not support orderby-limit for aggregated queries. To annotate
a query as an aggregate query, this patch adds a hint to the prepared
select statement that the pinotdb sqlalchemy driver then heeds.
Summary: We want to allow grouping by on expressions, including the
ability to select expressions (without group-by). The UI ain't good yet
.. it is not at the feature parity of say adhoc filters/metrics that
come with a nice text-box to edit the SQL. But
this suffices for my usecase for now.
(The UI would have to be redone ... but that would require some refactoring
to merge the AdhocFilter/Metric/Popover stuff such that it can be used
for this use case too.)
Also fixed a bug in the SelectControl freeForm selection.
Allow selecting all columns easily: Added a new Select-All special item
that users can select to make all the options in the selectable show
up.
The ability to group by arbitrary expressions is useful because now two
users don't need to create custom computed-fields for this.