Fixes#59005.
The FE-supplied `:dimension` column was being used directly, when it needs to be looked up anew on the massaged query.
Co-authored-by: Braden Shepherdson <braden@metabase.com>
* fix: card before update to not always force update (#59559)
* fixup! args to old fns
* fixup! remove schema version test
* fixup! implicit actions check
* fixup! handle inconsistent after-select mutations
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* Update upgrading-metabase.md
Adding a note about upgrading between major versions
* Update upgrading-metabase.md
* Apply suggestions from code review
---------
Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
* Manually close popover on escape
* Add repro for metabase#55673
* Revert "Manually close popover on escape"
This reverts commit cce85f0882.
* Trap focus in click actions popover
* Remove unneeded closeOnEscape
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
* fix: improve effective children performance
on the /items endpoint by reusing the permission CTE
* fix: remove n+1 hydration call for card children
* fix: remove case/whens in sort statements
* fix: scope search results for modal to collections
* fix: function to convert to collection items
* fixup! PR suggestion
* fixup! add row-lock fixture for mariadb flake
* add debug for failing test
* fixup! make sure api/bit->boolean is called first
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Nathan Voxland <nathan@metabase.com>
Co-authored-by: Ryan Laurie <ryan@metabase.com>
We can have tables in migrated instances that have two copies of the
audit db tables one with a 'public' schema and one with a 'PUBLIC'
schema. This handles that case.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* fix: check for row existence in parameter upsert
Do an exists check instead of relying on the result of `update!` being
zero. `update!` can return zero either when a row does not exist or when
there are no applicable changes in the request.
* fixup! use medley/mapply instead
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Some mysql -> postgresql migrated users still had adjust to source
failing because they had two tables with downcased names but one with a
"public" schema column and the other with a null schema column. This
handles that case by only selecting tables if there is not already a
table with a "public" schema column.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* Fix 3 flaky tests (#58729)
* Fix a flaky test for max-refingerprint-field-count
The code here goes through tables and refingerprints them (with all
their fields). After each table it checks the
`max-refingerprint-field-count` and stops if we've hit it.
The test gave some wiggle-room - we'd allow 10 extra fields. But in a
fresh run of my tests, the biggest table has... 13 fields. So if the
last table we hit before hitting the limit was *that* table, we exceed
our wiggle-room and the test fails.
Instead, the test now actually looks to see what's the biggest table we
have (in terms of number of fields), and asserts that the number of
fields refingerprinted is, at the most, the max plus that number of
fields.
* fix two more flaky tests
one is clearly a symptom of another test being super naughty but I can't
figure out which one. It's marked `parallel` and doing
```
(mt/with-temp [:model/Card {id :id} ...]
(do-something-with (t2/select-one :model/Card id)))
```
which is failing because `(t2/select-one :model/Card id)` is returning
nil. We can just pass the card that was actually returned by
`mt/with-temp` here and that should be more resilient to horrible tests
being horrible.
the other is checking that we're caching something by checking the call
count to toucan on the first and subsequent call to a function. But it
asserts that the first call count is exactly 6, which isn't relevant.
If I start a fresh REPL I get more than 6 the first time. It doesn't
matter! Just assert that we don't get MORE than the first time on the
second run!
* fix flaky tests freal
* fix: use t2/query to skip card callbacks
* fix: retry on failed pk insert
* fix: log when we have the cluster lock
* fix: try catching all sqlexceptions
* fix: add a fixture to pre-create the cluster_lock
* fixup! remove with-connection from update-used-cards
---------
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* fixup! fix cluster lock module require
---------
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* Add testing context around before-and-after gen tests
To ensure you can see the before and after queries as well as the steps that produced them when a test fails.
* Fix before-and-after :join in generative tests
Pass stage-number to check for aggregations and breakouts on the stage where the join was added rather than the final
stage.
Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
* keep backend pivot exports uncollapsed
* fix kondo errors
* update tests - only run collapsing tests on cljs, add a new test for clj that rows are not collapsed
* fix more kondo warnings
* cleanup
* Add an option to force multi-staged data picker
* Move type to a proper location
* Add `question` to `entity_types`
* Add ability to select saved questions back to multi-staged data picker
* Auto select Questions or Models when there is only a single option
* Prevent accidental types
* Remove unreachable code
* Default the join step after selecting a question to the question step
* Fix type errors
* Improve typing + fix unit tests
* Remove unnecessary await
* Add unit tests
* Update the default simple data picker value
* Fix the picker name typo
* Ignore `question` in Simple data picker
* Add E2E tests
* Move a constant out of a type file
* Fix types
* Address review. Make code more sane
* Address review. Improve variable name clarity.
---------
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Oisin Coveney <oisin@metabase.com>
* fix: prevent empty updated_at updates (#58811)
Use cluster locking around both last_viewed_at and view_count updateds
for report_dashboard models.
* fixup! merge added the api module in the wrong place
* fixup! old model with bad t2/changes
* fixup! old model test
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* Mega App DB memory usage improvements
* Add a test
* Minor comment formatting
* Fix test name
* This test can be ^:parallel
* Actually no it can not
* Fix test name
# Conflicts:
# test/metabase/db/connection_pool_setup_test.clj
Co-authored-by: github-automation-metabase <166700802+github-automation-metabase@users.noreply.github.com>
* Convert BigDecimals to double for color getter JS bundle (#58263)
* Convert bigdecimals in table static viz
* unit test; support for bigint conversion
* fix
---------
Co-authored-by: Tyler Plude <tsplude@gmail.com>
* Add lib.util/find-clause-by-uuid
* Lookup clause by uuid to generate the :long display-name for a :metadata/column
* Fix display-name expectations in targets.unit.spec.ts
* Fix display-name expectations in click-behavior.cy.spec.js
* Fix display-name expectations in filter-sources.cy.spec.js
* Review feedback: ensure last-stage? throw when given an invalid stage-number
* Review feedback: use lib.tu/venues-query
* Review feedback: explict true? and false? checks for first-stage? and last-stage?
Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
* fix alignment on table lists
* make all the lists align the same
* remove unnecessary 100% width
* standardize card widths
* fix up edit state
Co-authored-by: Maz Ameli <maz@metabase.com>
* Reduce parameter data sent in public csv download url (#57195)
* Only send id and value when downloading csv
* Add repro for metabase#51813
* Merge in template tag parameters to parameters when running cards
* Fix erroneous test
* Do not pass all parameter data for cards
* Remove commented out code
* Only pass sparse parameters on public dashboards or cards
* Remove unused import
* Fix lint
---------
Co-authored-by: Tamás Benkő <tamas@metabase.com>
* Add missing import
* Fix e2e test
---------
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
Co-authored-by: Tamás Benkő <tamas@metabase.com>
* fix: audit-db adjust source check for lower case (#58605)
* fixup! skip lowercase test on mysql
doesn't make sense to run pre-55 since our unique constraint before then
on mysql was case insensitive
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* fix: set download-results to no on table block (#58597)
* fix: set download-results to no on table block
When a view-data permission for a table is set to blocked set the
create-queries and download-results permissions to no. Also includes a
migration script read to backport to v52 to update databases to be
consistent with this change
* fixup! remove precondition
* fixup! join in update to work on mysql
* fixup! separate migrations on mysql/postgres
* fixup! test order
* fixup! replace add-user-to-group!
* fixup! set schema in a test
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* repurpose `entityTypeFilter` as `entityTypes` for new embedding data pickers for the SDK (#58208)
* used `entityTypeFilter` for new embedding data pickers
* Rename `entityTypeFilter` to be consistent with `entity_types`
* Migrate `entity_types` to a new reducer
* Add E2E test
* remove unused prop
* Fix interactive embedding's `entity_types`
* Fix unit tests
* Fix stuff that are missing because master removed it
---------
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
* Fix static question embed download when parameters have multiple values
* Simplify type
* Don't wanna deal with outdated query builder types 🤷
* Use a proper value when asserting
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Before, nest-query relied on the preprocessor (specifically, the add-implicit-clauses middleware) to add all possible
fields to the newly created inner query (and then removes unnecessary fields later). However, add-implicit-fields
ignores fields with a parent id. The main user of parent-id is mongo, and mongo doesn't use nest-query, so this
usually isn't an issue. However, bigquery also uses parent-id, and bigquery is a sql driver that uses nest-query. As
a result, nest-query wasn't adding bigquery struct member fields to the inner query, which caused some queries to
break. Now, nest-query explicitly finds all non-sensitive/retired fields (including fields with parent ids) and
ensures that they are in the inner query.
Co-authored-by: William <william@metabase.com>
* fix: audit db not working after import form h2
Removes conditions from the `adjust-audit-db-to-source!` function so we
make sure we always restoring the audit db tables to their original form
regardless of what type of app-db is used.
* fixup! test setting up db triggers
* fixup! cljfmt
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
run breaking changes tests on multiple runners
TO BE REVERTED BEFORE MERGING
force production fe build
build-release as setting node_env fucks up everything
exclude @OSS tests
Revert "TO BE REVERTED BEFORE MERGING"
This reverts commit c907a2f492.
Co-authored-by: Nicolò Pretto <info@npretto.com>
* Add additional check on rendering native preview panel
* adding e2e test
* adjusting e2e test
* do not show native panel when no data is selected
* move e2e test to instance analytics suite
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
* simplify embedding data picker code
* Show the data picker step based on starting query source
* Set starting model collection ID when joining a model
* Improve initial collection loading UX
* Fix failed unit tests and types
* Fix failed E2E tests
* remove unused var
* Fix sometimes the starting collection is incorrect
* Add an E2E test
* Add a comment to clarify
* Clarify a new prop
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
* VIZ-329 Updates ChartSettingInput and ChartSettingInputNumeric to apply changes when the user pauses typing in addition to on blur
* VIZ-329 Removes now-redundant blur handler in ChartSettingInputNumeric and updates unit tests
Co-authored-by: Brad Anderson <brad@metabase.com>
* fix: explicitly mark when fields are gtapped (#58113)
* fix: explicitly mark when fields are gtapped
* add debug
* fixup! tests setup to set advanced feature
* fixup! strip any user-added gtapped-tables keys
* fix a bad import
* fix test var
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* Make default toast color darker
* Avoid remounting the UndoList on overy toast change
* Tweak the undo animation to come in from the left
* Move more undo state into UndoListingOverlay
* Reverse toast order
* Manually manage undo target
* Remove unused props
* Store pause state in undo itself
* Use react-transition-group to render toast notifications
* Measure height so we can animate toast position
* Use css transforms only and avoid animating bottom
* Mock react-transition-group in test
* Unmount elements on exit
* Wait for animation in test
* Make toast ref optional
* Clean up transition
* Fix e2e test
* Disable transition group in cypress
* Add check_filled icon
* Default to check_filled
* Add text-secondary-inverse
* Use text-secondary-inverse color for icon on tooltip
* Remove min-width from toast
* Control the animation state of the todo's after moving the portal
* Fix icon in unit tests
* Simplify undo hooks
* Avoid overwriting state
* Add missing import
* Allow transitioning new todos even when not moving the portal
* Fix e2e test
* Update Loki Snapshots
---------
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
* fix typo
* don't error out during fields-metadata fallback if table is known to not exist
* table known to not exist impl for drivers
* add test
* add debug log
* add to changelog
* address review comments
Co-authored-by: Nicola Mometto <nicola.mometto@metabase.com>
* Fix the sorting of custom column from a saved card in a new question
* Remove the expression_name that is not actually used.
* Use col.name instead of expression_name in sanatizeResultData
* Remove additional :expression_name references in tests
* Remove comment that was attached to now-removed :expression_name
* Remove expression_name from static-viz components
* Remove expression_name from instance_analytics export
* Add comment to now-deprecated expression_name field in DatasetColumn
* Add e2e test for sorting on nested custom column
---------
Co-authored-by: Lifeng Lv <lvlifen9@gmail.com>
Conflicts:
src/metabase/query_processor/middleware/annotate.clj
test/metabase/query_processor/middleware/annotate_test.clj
Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
* Fix snowplow helpers to be less flaky (#57750)
Remove `expectGoodSnowplowEvents` entirely - it was an antipattern.
Replace it with a good set of snowplow helper functions that actually
accomplish what we want:
- `expectSnowplowEvent`, which matches on the *entire* event rather than
assuming the event is an unstructured event (most of ours are, but some
are not).
- `expectUnstructuredSnowplowEvent`, which behaves the same as
`expectGoodSnowplowEvent` used to, except I removed an unused behavior
where it took a function instead of a partial-match object.
- `assertNoUnstructuredSnowplowEvent`, which asserts the inverse of
`expectGoodSnowplowEvent` - there are zero matching snowplow events.
I removed `Good` from all these names as I think that's implied - if you
want to make an assertion that a bad event is being received you can
write your own helper :)
* fix
---------
Co-authored-by: John Swanson <john.swanson@metabase.com>
* Close table header popover on second click (#57282)
* Un-skip and update repro test
* Close table header popover on subsequent click
* Fix e2e test helper
We're greatly simplifying and speeding up a Metabase setup
when the use case is "embedding". This currently applies only to
hosted instances. The FE in the main app will expect the query param
`use_case=embedding` to exist. If it does, we're showing the simplified
setup flow.
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
We're using the `computed.filters` value in the handlebars email template.
Previously, if `parameters` were an empty list `[]` we were returning a truthy value,
and handlebars was rendering an empty row in an email.
@ngoc figured out that we need to wrap parameters with `seq` in order to have a
a proper `nil` assigned to `:parameters`.
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
* feat: generic data permissions visibility queries
Creates a new namespace with a generically applicable set of sql queries
for getting only models controlled by data permissions that a given user
has access to.
It also creates a new model.interface defmulti `visible-filter-clause`
that allows us to generate a filter clause for a given model to filter a
query on a supplied expression to only those models allowed for the
supplied user. There is a default implementation that is always true.
the `visible-filter-clause` method is only implemented for the Table
model so far since that is used in a search.
This also fixes a bug in the previous implementation of the sql
filtering for Table models that did not correctly handle the logic in
`data-perms/coalesce` for `:perms/view-data` where `:blocked` is ranked
ahead of `:legacy-no-self-service` for the purposes of selecting the
applicable user permission but is ranked below when testing permission levels.
* fixup! default for visible-fliter-clause to false
* fixup! add cast back for search permissions
* fixup! correct db type test
* fixup! more verbose table names in perms test
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
Closes#41265.
The schema for is-empty and not-empty was updated in #56855 to allow StringExpressionArg as well as Field. This
updates desugar-is-empty-and-not-empty to also understand non-field args.
Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
* Fix FE navigation when the query is running
* Fix FE navigation when the query is running
* Add test
* Add test
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
* make the uberjar artifact from the cross-version tests not collide with (#57971)
the one from component tests
* change retrieve key too
---------
Co-authored-by: Nicolò Pretto <info@npretto.com>
* Fix past1hours and past1seconds filters
Without this change, both of these types generate 1 minute intervals.
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
* Update upgrading-metabase.md
Add changes that were needed for a long time :)
* suggested edits (#57913)
---------
Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
* fix: wrap un-translated strings in t`` (#57693)
* fix: wrap un-translated strings in t``
* fix more untranslated strings
* translate some aria-labels
* use interpolation instead of having to provide context
* address feedback and add context
* more t calls added
* revert changes to slider component as it's not used and may get removed
* remove file that i re-created when rebasing
* more context
* more context
* Update frontend/src/metabase/query_builder/components/MoveQuestionModal/MoveQuestionModal.tsx
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
* Update frontend/src/metabase/query_builder/components/expressions/Editor/Listbox/Listbox.tsx
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
* address feedback
* add context to what is SSL short for
* remove whitespace that could possibly create issues
* add missing import for c
---------
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
* translate "Email Settings"
---------
Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
* feat: add a link to field filter docs from dashboard sidebar with native question
* oops
* add missing translation
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
* Updating text wrap and minibar logic to gracefully handle structure of column widths; updated fallback column width when no width is present in viz settings
* removing inline defs
Co-authored-by: Tyler Plude <tsplude@gmail.com>
* refactor: rename test file to tsx to have hopefully better diff in the
next commit
* fix EMB-360: Make Mantine components use the locale from LocaleProvider
* close EMB-373: make useLocale return the locale from LocaleProvider if
present
Co-authored-by: Nicolò Pretto <info@npretto.com>
* Use Mantine dropdown for snippet menu
* Fix search icon in snippet header too
* Remove default ICON_SIZE
* Fix MIN_SNIPPETS_FOR_SEARCH
* Add createSnippet helper
* Add repro for metabase#57441
* Add test for snippet search
* Move snippet helper to api
* Use actual ref for input
* Simplify header search rendering
* Use SidebarHeader for snippet sidebar
* Use Flex for most components
* Simplify padding
* Use class component for archived snippets
* Use class for header button
* Use direct properties
* Rely less on custom css
* Fix header padding
* Fix e2e tests
* Remove unused eslint-disable
* Add type annotation
---------
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
* Move SimpleDataPicker to a new directory preparing for new components
* Use the embedding data picker from a new folder
This requires turning the component into a plugin, which we'll do in the
next commit.
* Move plugin property to a more appropriate place
* Implement embedding multi-stage data picker as an EE plugin
* Add DataSourceSelectorProps
* Remove reference to query builder data picker
* Fix failing unit tests
* Move embedding data picker components to a proper location
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
* fix: add table-level sql based permission query (#57541)
* fix: add table-level sql based permission query
Some places in our code we may be returning fewer tables than a user has
access to because we load a limited number of models from the database
then apply permissions filters to those. This provides a subquery based
check for table permissions that we can use in other queries to do the
same kind of test for table access that we would do on the clojure-side.
Co-Authored-By: Nathan Voxland <nathan@metabase.com>
* fixup! restore check-permissions-for-model impl
* Update src/metabase/models/table.clj
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
* fixup! caluse -> clause spelling
* fixup! reformat malli annotations; add docstring
* fixup! add Literal type to honeysql helpers
* fixup! restore accidentally deleted clause
---------
Co-authored-by: Nathan Voxland <nathan@metabase.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
* fixup! kondo
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Nathan Voxland <nathan@metabase.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* cursor says this could fix the issue
* harder vibe coding
* remove handling of made up by llm elements that do not exist
---------
Co-authored-by: Vamsi Peri <vamsi@metabase.com>
Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
* Add reproduction for metabase#56775
* Pass the correct card to the location change
* Unwrap card when navigating to model or metric
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
When making sure stuff can load even with a loop, the circuit breaker was removed, leading to endless loops. That
would happen if the data causing the loop wasn't stripped properly. Right now if stripping things once did not help
and the entity is in the pipeline again, the process will break (with hopefully enough data to detect why).
This also changes the logic from exception to just recursive calls. Plus it's back at skipping all dashcards in a
Dashboard instead of just skipping visualization logic, which should make for a way faster processing (less deep for
sure). Plus it tries to improve logging a bit so it's easier to understand what's going on in complex cases.
Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
* closes viz-360 esc key should not add a recipient
* better code in e2e test to avoid eslint-disable-next-line
Co-authored-by: Sébastien <sebastien@metabase.com>
* feat: add prometheus metric for quartz task states
Adds a new quartz_task_state metric that will report to prometheus the
states of all quartz jobs running on a metabase instance using a guage.
Each task state is reported as a label and we also report a state for
tasks that are executing.
All hosts on a metabase cluster _should_ report the same value for these
metrics if they are scraped at the same time, and we need to consider if
the additional DB load is okay since this does query the database during
a prometheus scrape to report this metric.
* fixup! add job-name tag and histogram of job time
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* add locale selector to sdk storybook
* clarify the default value and change to have objects as items
Co-authored-by: Nicolò Pretto <info@npretto.com>
* fix: scheduler state management in cloud migration
When we create the h2 database to dump a metabase instance to during
cloud migration we need to stop and start the quartz scheduler instance
running on the instance during the migration.
Some liquibase migrations handling quartz job changes expect to control
the scehduler and start/stop it while those migrations run. Recent
changes to guard against this behaviour in testing case these
migrations to throw an exception when they run during the cloud
migration task.
This also fixes an older bug that the quartz scheduler would remain off
on the instance being migrated after the cloud migration task finishes.
* fixup! stop scheduler after all calls to migrate!
* fixup! formatting
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Avoid the possiblity of deadlocks during cached query processing by no
taking the connection using with-connection and instead just selecting
the cached result using toucan.
I _think_ this connection holding was introduced under the assumption
that we could 'stream' a binary column from postgresql using the
.getBinaryStreaming jdbc method. However postgres requires binary
columns to be full read and written and so we are unable to stream
results from that column, so this operation ends up being the same as
just querying the column normally.
Because we are not streaming the result in it seems safe to just yeild
the connection back to pool so it can shared with other requests.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* hide email domains for users without settings access
* fix test
* fix up e2e test
* update BE setting visibility
* Revert "update BE setting visibility"
This reverts commit b3728ad21d.
* remove commented-out line
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Fixes#56886
This is assuming that qp/ignore-coercion is set to avoid repeated casting. That means, that we should type is as if
the cast has happened.
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
* fix: wrong syntax on `if:` was making 'cross-version-for-breaking-changes'
always run
* Update .github/workflows/embedding-sdk.yml
---------
Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
result_metadata for a query on a model returns the underlying columns, not the model's columns. This was causing
drills to break in certain circumstances, because the query processor was trying to cast a particular value twice.
Making drills default to using the column from lib/returned-columns fixes the issue.
Co-authored-by: William <william@metabase.com>
* feat: upgrade ring-jetty to 1.14.1 (#55921)
* feat: upgrade ring-jetty to 1.14.1
Moves us onto Jetty 12 which has some features (pthreading, QoSHanlder)
that we may want to take advantage of.
* fixup! customize jetty metrics
* fixup! license info for jetty ee9
* fixup! make a var private
* fixup! don't use deprecated method
* fixup! create custom statistics handler
Replicate the Jetty 11 statistics handler that is able to report on
asynchronously handled requests separately from synchronously handled
ones. Also ports it to directly report statistics to our prometheus
rather than needing to build a connector between the stats handler
object and our metrics reporting
Co-Authored-By: John Swanson <john.swanson@metabase.com>
* fixup! fix race condition in stats test
* fixup! missing private annotation
* fixup! use normal jetty release with logging fix
---------
Co-authored-by: John Swanson <john.swanson@metabase.com>
* fix: request max time stat reports seconds (#57121)
Forgot to divide millis by 1000 before saving so this stat was reporting
some silly numbers on stats. Also adds tests around this metric
* fix: test flake in jetty stats (#57141)
---------
Co-authored-by: John Swanson <john.swanson@metabase.com>
* Fix 66k statement params in sync-table-privileges and sync-fks
* Test for privileges
* Test privileges
* Update and test set-initial-table-sync-complete-for-db!
Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
* wip
* More robust checking for timeout exceptions
Overview:
We enumerate items in the database and then we want to see which ones
the user can actually run queries against. To do this we run a query
like `select false from TABLE where 1 != 1 limit 0`. The hope is that
the query analyzer realizes it only needs to do permission checks and
doesn't try to satisfy these conditions (either because limit says no
rows, or 1 != 1 is easily proven to filter all rows). So we _usually_
get very quick feedback if we can select from the table or not.
Snowflake seems to not do this on views. If a view takes a long time to
query, snowflake seems to take a long time to query. The original fix
was to add a 15 second timeout to the query. The expectation here is
that Snowflake can quickly fail if there are no permissions for the
table or view, but might take a long time to run the probe query. But we
can interpret a timeout as a successful permission check.
The original way we checked for timeouts was a very naive check for
`java.sql.SQLTimeoutException`. It seems basically no one uses this when
you do:
```clojure
(with-open [stmt (...)]
(doto stmt
(.setQueryTimeout 15)
(.execute)))
```
For instance, here's some logs from Snowflake:
```
WARN net.snowflake.client.core.StmtUtil Cancelling query 0e8987ee-2d22-40f9-b30d-0129d38ce976 with reason TIMEOUT
INFO metabase.driver.sql-jdbc.sync.describe-database <schema>:<table-name>: Assuming no SELECT privileges: caught exception,net.snowflake.client.jdbc.SnowflakeSQLException: SQL execution canceled, at ...
```
Note It's a regular `net.snowflake.client.jdbc.SnowflakeSQLException`.
Here's a true permissions failure for comparison:
```
sync.describe-database <schema>:<table>: Assuming no SELECT privileges: caught exception,net.snowflake.client.jdbc.SnowflakeSQLException: SQL compilation error:,Failure during expansion of view 'SOME_VIEW': SQL compilation error:,Object 'DB.SCHEMA.TABLE' does not exist or not authorized.,
```
So we use some regex checks against the messages to try to detect when
we have a permissions failure (cannot select) vs a timeout of the
probe (presumably can select).
And a reminder of the balances here: it's better to show someone a table
that they get an error if they try to query than to hide a table that
they can query. So this change should bias towards reporting can-select
in cases where it might not be clear.
* Only run tests when classes are present
if you don't have :drivers on classpath it would fail
* ensure boolean is returned
tests assert false? on a nil
* CI fails based on the indentation of comments
* empty commit for CI
* Move postgres test into postgres test namespace
* Replace ex-msg matching with sqlerrorcode/sqlstate
Use jdbc error codes and sql state matching to figure out if a
SQLException is caused by user action canceling the request (essentially
how setQueryTimeout works). This adds a multimethod dispatching off the
driver keyword to match up either the SQLState code or the SQLErrorCode
with the appropriate value for a given database driver. Some of these
were found by looking how QueryTimeoutException is implemented in
Hibernate and others were found from JDBC driver source code or documentation.
* fixup! handle multiple codes for mariadb
* fixup! add partial query timeout test
* fixup! split apart sql timeout tests
* fixup! use correct sqlstate for snowflake timeout
* fixup! remove split out tests
* fixup! remove when-class
* fixup! snowflake sql state
* fixup! move query-canceled? into driver code
Removes the jdbc-exceptions namespace and instead makes query-canceled a
driver multimethod that extracts and dispatches on the SQLException
class within the sql-jdbc driver.
Non-jdbc drivers can implement this method, but it is only used for
handling errors in the cluster lock using the appdb and for the sql-jdbc
describe-database sync task.
* fixup! update driver changelog add default method
* fixup! merge mysql/mariadb methods
* fixup! add added metadata
* fixup! make test throw instead of is false
---------
Co-authored-by: dpsutton <dan@dpsutton.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Nathan Voxland <nathan@metabase.com>
* fix: improve database status metric
* Format line better
* Fix tests and kondo
* Remove unhealthy counter too
Co-authored-by: Case Nelson <case@metabase.com>
* add ttag/no-module-declaration rule (#56848)
* add ttag/no-module-declaration rule + eslint ignore comments
* change the reference to github issue instead of linear
* add new ignores after rebase
* remove formatting changes from eslint files
* fix eslint rule mising from a file
* convert one field to getter as that got added after I opened the codemod
pr and it's failing the check here
* more //eslint-disable-next-line
* manual fixes
---------
Co-authored-by: Nicolò Pretto <info@npretto.com>
Fixes#56434.
A join clause's `:fields` might contain refs to columns that no longer exist on the joined table/card.
Before this change, a malformed column was being passed to `with-join-alias`, causing it to throw.
Now the bad fields are dropped from `returned-columns`, and if they all get dropped then it is treated as `:all`.
Co-authored-by: Braden Shepherdson <braden@metabase.com>
the view_count and last_view_at updates of report cards can deadlock
against each other, so introduce a shared keyword they can use to each
take a cluster lock when updating these values to prevent the deadlocks.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* Adjust missing base type logging for jdbc drivers
* Adjust base type logging for Athena
* Add schema and table to missing base type logging
* Comments
* Update test
* Drop only preceding nils
Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
To avoid deadlocks on postgresql appdbs caused by overlapping ids in the
in clause of these updates.
I also had to change the `call-count` implementation for one of the
tests to spy on t2/query instead. The call-count pipeline middleware
will register either 2 or 4 depending on if we need to insert rows into
the lock table or not.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* ran the codemod, lets see if it greens out on ci
* manually remove some changes as not-needed or risky
* remove other createEntity
Co-authored-by: Nicolò Pretto <info@npretto.com>
* add tests for mb-wrapper leaks
* revert me - temporarily check diffs
* Revert "revert me - temporarily check diffs"
This reverts commit f474fe7b25.
* only apply mb-wrapper when in the sdk
* use cy.log to show e2e messages
---------
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
* Allow strings to be passed to isEmpty
* Add repro for metabase#55687
* Add be test for is-empty and not-empty
* Use Emptyable var
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
Avoids hitting the postgresql query parameter limit when there are more
than MAX_UINT16 tables in a database, also should be more efficient to
fetch this in a single query.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* pinned questions show moderated status, handle their own caption title
* unit tests, description
* fixing grid spacing
* e2e test adjustments
* fix for verified skeletons
* update quetion embed test, dashboard embed test
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
* fix(sdk): use instance locale if no locale is passed
* update docs
* we do support country codes, we have tests for it
* Update e2e/test-component/scenarios/embedding-sdk/locale-on-provider.cy.spec.tsx
* remove manual fallback to "en", site-locale is never undefined as it has
a default
---------
Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
* Log metric data for failures in qp.middleware.metrics/adjust
When qp.middleware.metrics/adjust fails to expand a metric, log the metric's name and dataset_query, not just the
metric id.
Closes QUE-862
* Update test to assert that metric data is present in ExceptionInfo
Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
* wip script to build the frankenjar
* build/run/test functions that seem to be working
* preparing for ci
* wip ci workflow
* need to run the job "manually" at least one to be able to dispatch it
from the gh cli
* add workflow_call
* bash instead of sh to solve issue of illegal option -o pipefail?
* use correct version of node
* prepare backend
* more envs to ci
* make jar run on the background in ci
* trying to run a list of specs in ci, tagging with tags probably won't
work as tags potentially need to be there on "older" versions of the
test
* fewer tests so it maybe doesn't timeout
* run on prs targerting the pr branch and the target base one
:wq
* clean up
* fix: without --env it wasn't really using the grepTags param:wq
* refactor: check for the actual files instead of doing ls*
* add back some more test files
* add log for ci
* remove colors as they're not shown in ci
* test: wait for data to load in a flaky test
* test: wait for data to load in a flaky test
* make sure we're building the EE jar
* skip licnese step as we don't need it
* move script out of embedding-sdk folder
* make curl -s to spam less in ci
* refactor: move jops to keep the result job last
---------
Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
* Correct output for dashboard filter variables
* Whitespace
* Add node script for testing clojurescript
* Enhance format-unit and add parse-unit.
parse-unit is new.
format-unit now works with moment (cljs) or java.time (clj) values, not just strings and numbers. I also added two new
units (:day-of-week-abbrev and :month-of-year-full).
* Refactor to use time/parse-unit and time/format-unit
Co-authored-by: Eric Normand <ericwnormand@gmail.com>
this happens because we're not hashing `now` in this case, but what is coming from DB; which is OffsetDateTime and can
have slightly different precision, leading to different hash.
Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
Fixes#51175
BigQuery sometimes returns timestamp values as floating point values (as strings, of course). We used to pass the
parsed double value to java-time.api/instant, but that seems to have microsecond precision. In this change we use
Java's built-in Instant construction function to keep the full precision.
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
* Add repro for #56596
* Allow escaping backslash
* Use unquoteString everywhere to parse strings and references
* Do string quoting and unquoting more consistently
* Add repro for #56596
* Make string parsing more straightforward and consistent
* Use quoteString to find errors with quoting
* Type string helpers more strictly
* Add fuzz tests for string quoting
* Move fuzz helper to test folder
* Make string fuzzing repeatable
* Add sanity check
* Fuzz all three quoting modalities
* Add [-quote tests
* Rename quote to delimiter
* Fix path for lexifier fuzz testing
* Fix name for compiler fuzz testing
* Use constant to store delimiter pairs
* Fix option name in formatter
* Add more cases around half-quoted strings
* Rename quote to delimiter in comment
---------
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
* Add route prop to disable command palette, Disable in setup routes
* increase wait timeout
* refresh user on setup
* Lets try a unit test instead
* removing refresh user from UserStep
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
* fix static charts may have incorrect series colors
* use hex colors in static viz
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
* call e2e-component-tests-embedding-sdk-cross-version from
embedding-sdk.yml
* add e2e-component-tests-embedding-sdk-cross-version to the tests-results
so it needs to pass (or be skipped)
Co-authored-by: Nicolò Pretto <info@npretto.com>
* Reset all errored triggers to `WAITING` on startup
* Add explanatory comments
---------
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Ed Paget <ed@metabase.com>
Metabase jars would crash when running on JVM 24 because the getReourse
method on the ClassLoader object was changed to return null if there is
no file at the provided path. This adds a ".keep-me" file to the
resources directory that Metabase can use to check if it is running in a
jar.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* fix: resolve snowflake sync cost issue
Using information_schema queries will cause snowflake to wake an
instance and thus incur costs. Using `show` queries will not do so.
In addition this adds a new multi-method for manipulating the results of
`describe-fields-sql`.
* Fix database-position and sorting
* Fix kondo
* Add order-by to mysql describe-fields
* Sort deps
* Use identity not map identity
* Fix databricks
* Address PR comments
Co-authored-by: Case Nelson <case@metabase.com>
* Allow lhs and rhs columns to be selected in existing join
* Only mark selected if there is a current selection (tests)
Also simplify the test.
Co-authored-by: Eric Normand <ericwnormand@gmail.com>
* feat: make cluster locking reusable
Builds a more generic interface for cluster locking using our existing
retry mechanism and jdbc level timeouts that will work with any database
rather than just postgresql.
* fixup! handle alt error text on mysql/mariadb
* fixup! don't lock on h2
* fixup! move malli annotations to retry
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* entity types for data picker
* dropdown and sidebar
* separate page
* note on metrics
* notes
* edit
* table
Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
* Don't update card metadata if it has not changed
* Store stored-metadata as a different field on info
* Fixed failing tests
* Update src/metabase/query_processor/middleware/results_metadata.clj
* Addressed review comments
* Update src/metabase/query_processor/middleware/results_metadata.clj
* Addressed review comments
* Update src/metabase/query_processor/middleware/results_metadata.clj
* Addressed review comments
* fixup! exclude info map from legacy normalization
* fixup! test that metadata equality skips update
* fixup! make adding the info map conditional
* fixup! use qp.store instead of adding to info map
* fixup! remove #p
* fixup! remove cyclic dep
* fixup! move load and store fns to same ns
* fixup! test name
---------
Co-authored-by: Nathan Voxland <nathan@metabase.com>
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Braden Shepherdson <braden@metabase.com>
Co-authored-by: Edward Paget <ed.paget@gmail.com>
* Store all native editor selected ranges in redux
* Pass all selected ranges to redux
* Add repro for metabase#54799
* Fix unit tests
* Fix typo
* Do not intersperse space in when running selected text
---------
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
This test was flaking if it was run close to the boundary of a UTC day
where the models could be created one day and then the clock ticked over
to a new day before the query ran.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* fix: snowflake can-connect with ssh without touching other drivers
* Adjust host-and-port for can-connect without calling incorporate-ssh-tunnel-details
Co-authored-by: Case Nelson <case@metabase.com>
We were inadvertently logging db-details in the rarely used
`maybe-test-and-migrate-details`. This changes to more of a data
diff where we can still get important information on how it changed.
Co-authored-by: Case Nelson <case@metabase.com>
* Hide trend line widget when multiple series present
* Adding unit test for trend line hidden state
* Prettier
Co-authored-by: Tyler Plude <tsplude@gmail.com>
* test: wait for data in a flaky test
* one more check
* set smaller viewport
* add wait
* add a helper
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
* fix missing useMemo in ad-hoc question
* add a test case for EMB-288
* fix test case for interactive dashboard
Co-authored-by: Phoomparin Mano <poom@metabase.com>
* Add a repro for #55951
* Fix typos
* Refactor repro
* Fix#55951
* Remove unused components
* Use 'loading'
* Format code
* Fix test setup
* Rename isLoading back to isSearchLoading since it indicates Search.loadList usage
* Use 1 /search API call instead of 2
* Get rid of rawData
* Update unit tests
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
* fix: deadlock in last used at
This prevents bulk updates to last used at from deadlocking by creating
a new table in metabase's database that can be used by instances to take
cluster wide locks. It adds an initial implementation of a customizeable
db-based locking mechanism.
For the last_used_at update, a metabase instance will first set a
session variable to control locking timesout then take a cluster lock
using SELECT * FROM metabase_cluster_lock WHERE lock_name = 'name' then
execute the update_at.
If another table is holding this lock metabase will wait .5s for the
lock to be released then timeout its SQL transaction, sleep the Thread
for 1s then retry taking the lock. This makes sure we're not holding DB
connections waiting for locks.
* fixup! kondo
* Update resources/migrations/001_update_migrations.yaml
* Update src/metabase/query_processor/middleware/update_used_cards.clj
* fixup! finish method rename
---------
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
* Fix formatter support for when both field ids and col names are used in viz settings
* Apply fix in qp common as well, which date formatter consumes
* Addressing PR feedback and breaking up large test
* Fixing or->merge reversion; adding datetime formatter tests
* Improving viz setting merges based on types of field_ref and column setting keys
* Addressing PR feedback
Co-authored-by: Tyler Plude <tsplude@gmail.com>
* fix: correct setting name check for static stats
also fix namespace for the defenterprise in token check to load the
embedding stats module
* fixup! use get-raw-value
* fixup! use-get-value-of-type
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* Split :cast into three features
* Update frontend feature names
* Update changelog
* PoC
---------
Co-authored-by: Eric Normand <ericwnormand@gmail.com>
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
Fixes [QUE-838](https://linear.app/metabase/issue/QUE-838/linked-filters-are-not-working-on-public-dashboards).
Query params were getting parsed incorrectly to a map like `{:17fdc812 ...}`
with a keyword rather than a string. These failed to match any of the
dashboard's parameters (which are keyed by strings like `"17fdc812"`)
and returned no values (but did not throw any errors in prod).
Co-authored-by: Braden Shepherdson <braden@metabase.com>
Before, when you had an outer query referring to something in a nested field from the inner query, the query processor
would assume the field is still nested and generate invalid sql. Now, it will just refer to the alias.
Co-authored-by: William <william@metabase.com>
# Support Environment Variables for API Keys
### Overview
This PR adds support for using environment variables to define API keys in the configuration file, enhancing security and flexibility for deployment environments.
### Changes
- Modified API key validation to support environment variable substitution in the key field
- Added runtime validation for API keys from environment variables to ensure proper formatting
- Refactored tests to properly validate environment variable integration
- All API keys (including those from environment variables) still must follow the required format:
- Must be between 11-254 characters
- Must start with mb_
- Must match the pattern mb_[A-Za-z0-9+/=]+
### Usage
```
api-keys:
- name: "ENV API Key"
key: "{{env API_KEY_FROM_ENV}}"
creator: "admin@example.com"
group: "admin"
```
### Testing
- Creation of API keys from environment variables
- Validation of API key format from environment variables
- Error handling for improperly formatted environment variable values
# Skip keys if they exist
To guarantee that it is possible to keep the same yaml file on each instance initialization, if there is a key in the instance and the config file has a key with the same name, the creation is skipped.
Co-authored-by: Luiz Arakaki <luiz.arakaki@metabase.com>
* Move the lexifier to it's own file
* Remove duplicate type union member
* Remove unused typeinferencer
* Add ParseError type to errors
* Lexify straight in to pratt.Token
* Remove unused TOKEN type
* Use pratt.Token type everywhere
* Fix type
* Remove unused __support__/expressions helper file
* Ignore END_OF_INPUT when matching suggestions
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
* Fix compilation of case with clauses that need pre-processing (#55958)
* Fix test
---------
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
Fixes#55929. (Requires a new export for 54 that also gets backported.)
Adds a new setting `install-analytics-database` that skips loading the
database at all, if set to false. That allows the dev instance that
exports the analytics content to have no real audit DB, and therefore to
generate the right `entity_id` hashes for the audit export!
Existing audit DBs are fine; the checksum will see these new entity_ids
in the export and overwrite any existing content.
Co-authored-by: Braden Shepherdson <braden@metabase.com>
* fix: Ensure that local timestamps params work
Fixes#53371
By filtering a timestamp or date column on an OffsetDateTime it results
in an index being missed since the lhs needs to be upcast by the db engine
to a `timestamp with timezone`.
This ensures we only pass OffsetDateTime to `timestamp with timezone`
columns.
Context about decision here:
https://metaboat.slack.com/archives/C0645JP1W81/p1743111964032089
* Handle sending a datetime range rather than just a date
* Feature gate to dynamic dataset loading
* Fix kondo
* Remove comment
Co-authored-by: Case Nelson <case@metabase.com>
* Rename caseInsensitive to caseSensitivity
* Use literal string for case-insensitive template
* Update argument description to be more clear
* Support inline expression highlights
* Render help text description with Markdown
* Add more markdown to help text strings
* Use markdown code blocks to mark code in help text descriptions
* Highlight argument references in help text descriptions
* Fix arg alignment
* Fix HelpText unit tests
* Fix FunctionBrowser tests
* Render FunctionBrowser descriptions using Markdown too
* Mark true
* Fix e2e tests
* Fix e2e tests
* Remove commented-out code
---------
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
* Apply all passes to examples
* Add format test for offset example
* Make sure all help texts return a string
* Add repro for #55940
* Typo
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
* Auto-categorize truncation units as datetime columns in insights code
* detect datetime units on the FE as well when rendering trend visualization
* prettier
* add unit test
* typo
* fix comment alignment
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
* Initial support for text wrapping in static viz
* Add text-align support
* Add row index support
* Fixing broken unit tests
* Adding new unit test coverage for Tanstack viz settings
* Fixing typo in whitespace; removing debug def
* Removing defs & outdated comment
* Addressing PR feedback
* Adding column width support to minibar columns; improving doc strings
* Adding minibar column width support; improving doc strings; moving consts to style namespace
* Fixing broken unit test after font size change
* Remove trailing whitespace
Co-authored-by: Tyler Plude <tsplude@gmail.com>
* Minibar chart support in table static viz
* Fixing unit test; adding new minibar unit test
* Fixing clj kondo warnings
* Addressing PR feedback
* Removing dead minibar code
* Removing old minibar unit tests
Co-authored-by: Tyler Plude <tsplude@gmail.com>
* feat: add remaining token check stats and settings
Adds the remaining five data points we want to report during the token
check request. Adds a new module to internal stats that does the
embedding counts and setting checks.
* fixup! log stats
* fixup! move enterprise settings into defenterprise
* fixup! remove row count
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* fix: only remove vis_settings from dashboardcard
Fixes loading serialized dashboard cards where we would previously
delete and recreate them on each load.
In order to handle circular dependencies caused by links to other
dashboards in a dashboardcard's visualization_settings we were removing
the dashboardcards entirely from the dashboard model to break the cycle.
Later when we traversed back through the dependency path we would load
the original dashboard a second time with the restored dashboardcards.
However, on the load of the cycle breaking change we could entirely drop
dashcards belonging to the dashboard because the serialization code was
treating our cycle breaking changes as an edit to the dashboard to drop those
cards. This meant when we got back to the the second load of the
dashboard we would create the dashcards fresh instead of updating
existing instances.
The fix here is that we only remove the values from the dasboard card
model that can cause the cycle -- in this case just the
visualization_settings column. This seemed the most straightforward fix,
but there are other possibilities here.
One is that we could _just_ preserve the entity_id column in dashcards
which would eliminate the possibility of any other cycles here.
Another option would be to change how we handle nested models in serialization.
There is not really a foreign key dependency here between dashboard A
and dashboard B linked by the dashboard card. If we instead just created
those dashboards first _then_ went back and created their dashcards we
don't have any problems at all. We could move nested models up to the
same level of handling in serialization that we do for models, which
would let us create the dashboards first then create any dashboard cards
in a subsequent step.
* fixup! update docstring
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
```
2025-03-27 15:25:21,322 INFO sync.describe-database :: Checking "PUBLIC"."LARGE_NUMBERS"
2025-03-27 15:25:21,757 INFO sync.describe-database :: "PUBLIC"."LARGE_NUMBERS": SELECT privileges confirmed
2025-03-27 15:25:21,759 INFO sync.describe-database :: Checking "PUBLIC"."SINGLE_ROW_TABLE"
2025-03-27 15:25:21,975 INFO sync.describe-database :: "PUBLIC"."SINGLE_ROW_TABLE": SELECT privileges confirmed
2025-03-27 15:25:21,976 INFO sync.describe-database :: Checking "PUBLIC"."SLOW_QUERY_VIEW"
2025-03-27 15:25:22,219 INFO sync.describe-database :: "PUBLIC"."SLOW_QUERY_VIEW": SELECT privileges confirmed
```
This will list all tables it enumerates and then which ones it
removes. There are also two error handling states:
```
2025-03-27 15:29:25,418 INFO sync.describe-database :: "schema"."some_table": SELECT privileges confirmed
2025-03-27 15:29:25,419 INFO sync.describe-database :: "schema"."some_table": Assuming SELECT privileges: caught timeout exception
2025-03-27 15:29:25,419 INFO sync.describe-database :: "schema"."some_table": Assuming no SELECT privileges: caught exception
java.lang.Exception: Some exception
at metabase.driver.sql_jdbc.sync.describe_database$eval194718.invokeStatic(NO_SOURCE_FILE:33)
at metabase.driver.sql_jdbc.sync.describe_database$eval194718.invoke(NO_SOURCE_FILE:33)
[more stacktrace from the exception]
```
This is essentially just changing the log level. We can and perhaps
should change these back to debug or trace in the future but this is
useful for now.
Co-authored-by: dpsutton <dan@dpsutton.com>
* test: make dashboard flaky test more robust and stable
* revert flaky
* add additional check
* fix that works locally
* revert prev version
* add missing line
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
* Update some function names to match modern casing
* Fix test cases
* Update casing in docs for isEmpty, notEmpty, lTrim, rTrim, isNull, and notNull
* Fix isNull and isEmpty casing in tests
* Fix case in unit test
* Fix casing in e2e tests
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
* Fix couldn't find Slack channel
When the first `conversations.list` doesn't return the Slack channel we
want, we need to continue to paginate until we found it.
* [debug] for testing
* Revert "[debug] for testing"
This reverts commit 67dd2c0405.
* Simplify logic
---------
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Timofey Kachalov <timofei@metabase.com>
* Add group mappings in keycloak
* Apply suggestions from code review
---------
Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
Improve the performance of the collection permission query by using a
semi-join instead of an inner join to the permission tables. This
ensures each collection only needs to be tested once for a route that
gives a user permission to access it rather than multiple times.
This reduces the query time for users that are members of lots of
collections since we dont need postgresql to create large join tables or
return the same collection id more than once from this query.
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
* Match functions even when the current token is an identifier
* Add repro for metabase#55686
* Use existing function in test
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
* Add Expressionable
* Accept Lib.Expressionable in expression editor
* Remove type casts in AggregationPicker and FilterPicker
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
* fix: add index to field_usage query_execution_id
Supports faster deletes on the query_execution table. Without this index
deleting rows from that table leads to a seq scan on the field usage
table for each row deleted to handle the ON DELETE CASCADE trigger.
* fixup! drop empty preconditions
Co-authored-by: Edward Paget <edpaget@users.noreply.github.com>
Previously we looked at 1000 users and got the set of unique user
attribute names from them. So if 1000 users each had a `name` and user
1001 had `some-other-attribute`, we would give you back `name` as the
complete set of available attributes.
This modifies the magic number (to 5000 from 1000) and the logic. We
select the first 5000 unique *attributes*. So if 1000 users each have a
`name`, that only counts as 1, and we'll continue looking for other
unique attributes before returning to the client.
Co-authored-by: John Swanson <john.swanson@metabase.com>
Implemented validation that ensures API keys when created with config.yml:
Start with the mb_ prefix
Have a minimum length of 12 characters and max 254
Prefix (first 7 characters) must be unique
String must be Base64
Co-authored-by: Luiz Arakaki <luiz.arakaki@metabase.com>
compojure.core/context{:message"Use metabase.api.util.handlers/route-map-handler instead of compojure.core/context, it is much faster and supports OpenAPI spec generation"}
compojure.core/defroutes{:message"Use metabase.api.util.handlers/defroutes instead of compojure.core/routes, it supports OpenAPI spec generation."}
compojure.core/routes{:message"Use metabase.api.util.handlers/routes instead of compojure.core/routes, it supports OpenAPI spec generation."}
clojurewerkz.quartzite.jobs/defjob{:message"Use metabase.task/defjob instead of clojurewerkz.quartzite.jobs/defjob"}
fipp.edn/pprint{:message"Use metabase.util.log instead of fipp.edn/pprint"}
honeysql.core/call{:message"Use hx/call instead because it is Honey SQL 2 friendly"}
honeysql.core/raw{:message"Use hx/raw instead because it is Honey SQL 2 friendly"}
@@ -299,7 +301,7 @@
honeysql.types{:message"Use Honey SQL 2. Honey SQL 1 is removed as a dependency in Metabase 49+."}
honeysql.util{:message"Use Honey SQL 2. Honey SQL 1 is removed as a dependency in Metabase 49+."}}
:discouraged-tag{p{:message"You can use it, but don't commit it."}}
:discouraged-tag{p{:message"You can use it, but don't commit it."}}
if [[ "$output" == *"not included in the documentation"* ]]; then
echo "$output"
exit 1
fi
}
- name:Comment on PR if docs need update
uses:./.github/actions/notify-pull-request
if:success() || failure()
with:
remove-previous-comment:true
add-new-comment:${{ job.status == 'failure' }}
message:"📝 One or more internal Metabase types were accidentally exported from the `@metabase/embedding‑sdk‑react` package in this pull request.<br/><br/>Publishing these types would change the public API and may drastically change generated SDK documentation.<br/><br/>Please update the code so internal types remain private and the public API stays unchanged."
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.