This project is mirrored from https://github.com/metabase/metabase.
Pull mirroring updated .
- Dec 10, 2021
-
-
Cam Saul authored
* Refactor: move Card and Dashboard QP code into their own qp.* namespaces * Disable extra validation for now so a million tests don't fail * WIP * Validate template tag :parameters in query in context of a Card * Fixes * Disable strict validation for now * Test fixes [WIP] * Make the parameter type schema a little more forgiving for now * Tests & test fixes
* More test fixes * 1. Need more tests 2. Need to actually validate stuff * More test fixes. * Test fixes (again) * Test fix * Some test fixes / PR feedback * Disallow native queries with a tag widget-type of "none" Template tags with a widget-type that is undefined, null, or "none" now cause the query's isRunnable method to return false. Existing questions that have this defect won't be runnable until they are resaved with a set widget-type. * Fix prettier error * add snippet and card types to validation pass * Make sure template tag map keys + `:names` agree + test fixes * Have MBQL normalization reconcile template tags map key and :name * Test fix * Fix tests for Cljs * Fix Mongo tests. * Allow passing :category parameters for :text/:number/:date for now. * Dashboard subscriptions should use qp.dashboard code for executing * Make sure Dashboard QP parameter resolution code merges in default values * Add a test for sending a test Dashboard subscription with default params * Prettier * If both Dashboard and Card have default param value, prefer Card's default * Test fix * More tests and more fixes Co-authored-by:Dalton Johnson <daltojohnso@users.noreply.github.com>
-
Alexander Polyankin authored
-
- Dec 09, 2021
-
-
adam-james authored
* Added URL to test for repro of issue #14491 * Allow alphanumeric and _ characters in domains. Hostnames and domains are not the same. Hostnames have the restriction of alphanum, hyphen, and must start with an alpha char. This is what our regex seemed to match before. Relevant RFC for domain names: [https://www.rfc-editor.org/rfc/rfc2181#section-11](RFC2181 Section 11) Relevant RFC for hostnames: [https://www.ietf.org/rfc/rfc1123.html#section-2.1](RFC1123 Section 2.1) It seems that our url? regex is for hostnames, and is based on the UrlValidator code from apache commons. Though the issue #14491 author brings up the RFC1034 (which links to RFC1123 with a bit of a spec) to indicate that underscores SHOULD be allowed, they aren't really in that case. But it seems that there's wiggle room in allowing it for 'domains' generally, and perhaps we should permit the use of underscores in this URL validation to allow for more configuration options for our users. A stackoverflow page with helpful context and explanantion which helped me think about this: https://stackoverflow.com/questions/2180465/can-domain-name-subdomains-have-an-underscore-in-it * Fixed spacing
-
- Dec 08, 2021
-
-
Howon Lee authored
Combo type and multiple cards for static viz BE. These go into one FE endpoint but are two really separate things in BE. This one conforms to the FE type but the price is that the previous more-dynamic BE types needed to be changed to conform: this will require a refactoring to whack the js-viz types that already exist, when the FE is refactored also.
-
- Dec 07, 2021
-
-
Ben Cook authored
-
dpsutton authored
* Only select type information on type inference of coalesce This previously just selected hte inferred information from the second argument to the coalesce. For fields this would return the entire field object which includes an id. Later, in `source-metadata->fields` this assumes that since an id is present, we should select `[:field id nil]`, but this confused that the type of the coalesce column is the same as that field-id, not that we want to select that field id. ```clojure add-source-metadata=> (pprint (mbql-source-query->metadata {:source-table 2 :joins [{:fields [[:field 22 {:join-alias "People - User"}] [:field 15 {:join-alias "People - User"}]] :source-table 3 :condition [:= [:field 3 nil] [:field 22 {:join-alias "People - User"}]] :alias "People - User"}] :expressions {:coalesce [:coalesce [:field 3 nil] [:field 22 {:join-alias "People - User"}]]} :aggregation [[:count]] :breakout [[:expression "coalesce"]]})) ({:semantic_type :type/FK, :table_id 2, :coercion_strategy nil, :name "coalesce", ;; merging maintains the correct name :settings nil, :field_ref [:expression "coalesce"], ;; merging maintains the field ref :effective_type :type/Integer, :parent_id nil, :id 3, ;; the type inference selected ;; the entire field, including its id :display_name "coalesce", :fingerprint {:global {:distinct-count 929, :nil% 0.0}}, :base_type :type/Integer} {:name "count", :display_name "Count", :base_type :type/BigInteger, :semantic_type :type/Quantity, :field_ref [:aggregation 0]}) nil ``` updating to only select the type information: ```clojure add-source-metadata=> (pprint (mbql-source-query->metadata {:source-table 2 :joins [{:fields [[:field 22 {:join-alias "People - User"}] [:field 15 {:join-alias "People - User"}]] :source-table 3 :condition [:= [:field 3 nil] [:field 22 {:join-alias "People - User"}]] :alias "People - User"}] :expressions {:coalesce [:coalesce [:field 3 nil] [:field 22 {:join-alias "People - User"}]]} :aggregation [[:count]] :breakout [[:expression "coalesce"]]})) ({:name "coalesce", :display_name "coalesce", :base_type :type/Integer, :effective_type :type/Integer, ;; no more field information beyond ;; the types :coercion_strategy nil, :semantic_type :type/FK, :field_ref [:expression "coalesce"]} {:name "count", :display_name "Count", :base_type :type/BigInteger, :semantic_type :type/Quantity, :field_ref [:aggregation 0]}) ``` * Update question in repro now that it doesn't fail on the backend previously this question would actually fail on the backend and independently the frontend would go into a stack overflow killing the page. Fixing the bug actually broke the test as it asserted that the query would break and look for the error message. Now that the query returns assert we can find the name of the question "test question" * Correct same bug for case When inferring type for a case, we were returning the type information for the first field we could find in the case statement. And that information included the field id. We always merge the current column's name on top of that to remove the analyzed field's name and other things, but the field-id would remain. `source-metadata->fields` in add_implicit_clauses will add a field reference if it finds a field id. Before, the following was returned ```clojure ({:description "The date and time an order was submitted." :semantic_type :type/CreationTimestamp :table_id 2 :coercion_strategy nil :unit :month :name "CREATED_AT" :settings nil :source :breakout :field_ref [:field 4 {:temporal-unit :month}] :effective_type :type/DateTime :parent_id nil :id 4 :visibility_type :normal :display_name "Created At" :fingerprint {:global {:distinct-count 9998 :nil% 0.0} :type {:type/DateTime {:earliest "2016-04-30T18:56:13.352Z" :latest "2020-04-19T14:07:15.657Z"}}} :base_type :type/DateTime} {:description "The raw, pre-tax cost of the order. Note that this might be different in the future from the product price due to promotions, credits, etc." :semantic_type :type/Quantity :table_id 2 :coercion_strategy nil :name "distinct case" :settings nil :source :aggregation :field_ref [:aggregation 0] :effective_type :type/Float :parent_id nil :id 6 :visibility_type :normal :display_name "distinct case" :fingerprint {:global {:distinct-count 340 :nil% 0.0} :type {:type/Number {:min 15.691943673970439 :q1 49.74894519060184 :q3 105.42965746993103 :max 148.22900526552291 :sd 32.53705013056317 :avg 77.01295465356547}}} :base_type :type/BigInteger}) ``` The important bit above is that the metadata for the "distinct case" has the correct field_ref but also has a field id. After, we now return the following metadata: ```clojure ({:description "The date and time an order was submitted." :semantic_type :type/CreationTimestamp :table_id 2 :coercion_strategy nil :unit :month :name "CREATED_AT" :settings nil :source :fields :field_ref [:field 4 {:temporal-unit :default}] :effective_type :type/DateTime :parent_id nil :id 4 :visibility_type :normal :display_name "Created At" :fingerprint {:global {:distinct-count 9998 :nil% 0.0} :type {:type/DateTime {:earliest "2016-04-30T18:56:13.352Z" :latest "2020-04-19T14:07:15.657Z"}}} :base_type :type/DateTime} {:base_type :type/BigInteger :effective_type :type/Float :coercion_strategy nil :semantic_type :type/Quantity :name "distinct case" :display_name "distinct case" :source :fields :field_ref [:field "distinct case" {:base-type :type/BigInteger}]} {:semantic_type :type/Quantity :coercion_strategy nil :name "cc" :expression_name "cc" :source :fields :field_ref [:expression "cc"] :effective_type :type/Float :display_name "cc" :base_type :type/Float}) ``` * Add tests looking for full field analysis without id
-
- Dec 06, 2021
-
-
Noah Moss authored
-
Alexander Polyankin authored
-
Noah Moss authored
-
Alexander Polyankin authored
-
- Dec 03, 2021
-
-
Jeff Evans authored
* Enable Postgres driver to use secrets for configuring SSL parameters Adding secret related properties for SSL options to Postgres driver Move `conn-props->secret-props-by-name` to secret.clj since it's needed directly there, too Add `us-east-2-bundle.pem` to `test-resources/certificates` for testing Postgres with SSL connectivity to our RDS instance (and a README.md explaining how it differs from the existing `ssl` directory) Updating `value->file!` to have better logic for building the error message when the existing file is not found (for better UX from the Database admin page) Updating frontend to support the `visible-if` value being an array, in which case any value may match the current details value, in order for that field to be visible Adding secret related properties for SSL options to Postgres driver Updating CircleCI config.yml to refer to the RDS instance when running Postgres SSL test Implement server side expansion of transitive visible-if dependency chain Update shouldShowEngineProvidedField on client to consider multiple key/value pairs in the visible-if map, and only show the field if ALL are true Adding new test to confirm transitive visible-if resolution, and cycle detection Add Cypress test for SSL field visibility
-
Noah Moss authored
-
Noah Moss authored
-
Noah Moss authored
-
- Dec 02, 2021
-
-
Cam Saul authored
* Require data permissions to set parameter mappings * Impl for sandboxed permissions * Allow updating dashboard if parameters haven't changed; more tests * Fix premature i18n lookups
-
Cam Saul authored
-
Cam Saul authored
-
Howon Lee authored
Static viz for funnel plots. Pursuant to #18676.
-
- Dec 01, 2021
- Nov 30, 2021
-
-
Jeff Evans authored
* Limit autocomplete results for tables and fields Add limit of 50 total fields or tables returned from the autocomplete_suggestions API, which can be a mixture of tables and/or fields Adding test that confirms results are limited properly
-
- Nov 28, 2021
-
-
Howon Lee authored
BE for progress bar for static viz, sasha put in the FE bits a bit ago
-
- Nov 23, 2021
-
-
Noah Moss authored
-
Noah Moss authored
-
Cam Saul authored
New dashboard query endpoints and consolidate Dashboard API/Public/Embed parameter resolution code (#18994) * Code cleanup * Make the linters happy * Add pivot version of the new endpoints * implement usage of the new dashboard card query endpoint (#19012) * add new endpoints to services.js * replace CardApi.query with the new endpoint + pass dashboardId * add parameter id to parameter object found on query body * run dashchards using card query endpoint when they're new/unsaved on dashboard * Update endpoint references in e2e tests * Remove count check from e2e test We can make sure a double-mapped parameter filter shows results from both fields, but unfortunately with the new endpoint, the results don't seem to work anymore. I think that's OK? Maybe? * skip corrupted filters test the query endpoint now results in a 500 error caused by a schema mismatch * fix a few e2e intercepted request mismatches * unskip filter corruption test and remove the part that no longer works Co-authored-by:
Dalton <daltojohnso@users.noreply.github.com>
-
Noah Moss authored
-
Alexander Polyankin authored
-
- Nov 22, 2021
-
-
Noah Moss authored
-
- Nov 17, 2021
-
-
Jeff Evans authored
* Add SSL keystore and truststore secret properties to Oracle driver YAML files Update Oracle driver to set keystore and truststore connection options from secret values Adding new `select-keys-sequentially` helper function for dealing with assertions on transformed conn props Add new function to the secret namespace to return a lighter weight "secret map", and remove that functionality from the `handle-db-details-secret-prop!`, so that it can be reused from connection testing Modifying CircleCI to set the corresponding truststore secret conn prop vars instead of JVM-level truststore settings, as the test had been doing previously Expand Oracle test connection details to incorporate all SSL related properties, and also make it a function instead of delayed def (so changes can be picked up later) Misc. fixes in Oracle driver YAML files Update `exception-classes-not-to-retry` to include SSLHandshakeException Fix misc issues in secret and database model code Update CircleCI config to use correct secret based env var keys and values Add *database-name-override* dynamic var in `metabase.test.data.interface` to allow for DB name overriding Fix up ssl connectivity test so all parts pass successfully Get rid of crazy with-redefs to swap in the existing test-data's schema, and instead, just dropping the DB if it was created under a different schema (similar to what H2 does) Co-authored-by:
Gustavo Saiani <gustavo@poe.ma>
-
- Nov 15, 2021
-
-
john-metabase authored
-
dpsutton authored
* Get rid of the n-queries old logic: select last view logs, and then for each one, select its associated model (card, table, etc). new logic: get the last view logs, and do three batch queries, one each to card, dashboard, table, for the ids from the view logs * Mark datasets in api/activity/recent_views * Get rid of `(db/delete! Activity)` in tests * Handle datasets in activity list
-
Howon Lee authored
Static viz waterfall needs BE bits. Here are the BE bits. Color and total summation coming...
-
- Nov 12, 2021
-
-
Noah Moss authored
-
- Nov 11, 2021
-
-
dpsutton authored
* Speed up interger or string recognition jeff helpfully pointed this out. I did some repl benchmarks ```clojure (comment (doseq [x ["3" "bob"]] (dotimes [_ 3] (time (dotimes [_ 10000] (try (Integer/parseInt x) (catch NumberFormatException _ x)))))) (doseq [x ["3" "bob"]] (dotimes [_ 3] (time (dotimes [_ 10000] (if (re-matches #"\d+" x) (Integer/parseInt x) x)))))) tiles-test=> (doseq [x ["3" "bob"]] (dotimes [_ 3] (time (dotimes [_ 10000] (try (Integer/parseInt x) (catch NumberFormatException _ x)))))) "Elapsed time: 5.72825 msecs" "Elapsed time: 1.531042 msecs" "Elapsed time: 0.797041 msecs" "Elapsed time: 32.120875 msecs" "Elapsed time: 27.848375 msecs" "Elapsed time: 23.820542 msecs" nil tiles-test=> (doseq [x ["3" "bob"]] (dotimes [_ 3] (time (dotimes [_ 10000] (if (re-matches #"\d+" x) (Integer/parseInt x) x))))) "Elapsed time: 5.356417 msecs" "Elapsed time: 1.97225 msecs" "Elapsed time: 1.868708 msecs" "Elapsed time: 1.214666 msecs" "Elapsed time: 1.185625 msecs" "Elapsed time: 1.19025 msecs" nil tiles-test=> ``` * Only select lat/lon fields in api/tiles We required the index of lat and long columns, ran the whole query, and then just grabbed those columns in a `(for [row rows] [(nth row lat-idx)..])`. But of course we can just update the fields we want to select in the query. MBQL and native queries flow through this codepath depending on the source of the query of the card being mapped. For mbql queries, it is straightforward, add a filter on the lat long and replace the fields with just lat and long fields. For native, we nest the native query as a nested query and then proceed on the resulting mbql query. The only difference is requiring the type annotation for the field type. mbql field: [:field 32 nil] vs [:field "latitude" {:base-type :type/Float}] This addresses memory concerns. The query is not limited and we don't need to select an entire row for these purposes. Dropping lots of text fields, id fields, etc could save quite a bit of memory when resolving the entire result set in memory. * Add limit to number of coordinates per tile these queries were unbounded in getting coordinates for each tile. But in a visualization, can there really be more information provided? We were leaving them unbounded and getting back millions of rows (reported on #4844). So we were adding unnecessary detail at the price of OOM errors. Note tests have been changed to show that the limit of the original mbql query is clobbered and the limit of the original native query is only present in the nested query whereas the outer query selects its own limit. As always, should this number be exposed as a setting? Configurable in the UI? Leaving as a hardcoded and documented number for the moment. * docstring * Remove col indices from api/tiles since we just select the actual columns we want, we no longer need the index in the results of those cols. they are always the first and second columns * Trim final slash on url
-
dpsutton authored
* Nest qbnewb under /modal to allow for other modals move the api from api/user/:id/qbnewb -> api/user/:id/modal/qbnewb to allow for the upcoming new dismissable modal * Add additional datasetnewb route staying with the same naming scheme as qbnewb. the db field is is_datasetnewb, the route just takes datasetnewb. I'm not wild about the default is true, set to false, and the naming scheme. But will be easier to migrate and easier for FE to use if we continue the defaults/logic etc. * Remark on db change in migration file
-
- Nov 10, 2021
-
-
dpsutton authored
-
- Nov 09, 2021
-
-
Jeff Evans authored
Secrets
PR 5 - Translate secret connection-properties into existing types understood by frontend (#18236) * Translate secret connection-properties into existing types understood by frontend For all :type :secret properties, before returning over the wire (i.e. from `available-drivers-info`), translate the connection-property into one or more new client side properties, using the existing types, to encapsulate the behavior of that individual secret "unit". Depending on the :secret-kind and hosting environment, this could mean there are multiple additional properties injected (one for the file upload versus local path option field, one for the value itself on upload, and one for the file path) Adding utility function to do the reverse (i.e. translating those client side properties back to the server secret property definition) Adding tests for both (including updating secret-test-driver to cover all of these) Add support for the treat-before-posting connection property config * Fix bug in `delete-orphaned-secrets!`
-
- Nov 08, 2021
-
-
Pawit Pornkitprasan authored
* Use SameSite=None for EMBEDDED_SESSION and DEVICE cookies - EMBEDDED_SESSION previously did not specify SameSite attribute and assumed that the browser would default to SameSite=None, but recent browsers default to SameSite=Lax which does not work with cross-domain full-app embedding. - DEVICE was previously set to SameSite=Lax causing devices to not be remembered during login with cross-domain full-app embedding resulting in superfluous "We've Noticed a New Metabase Login" emails. Setting it to SameSite=None is safe because the cookie is not used to authenticate a user. * Only print SameSite warning if not over https
-
Jeff Evans authored
* Add backend support for keystore type secrets Adding code to handle keystore type secrets Adding test code to create and verify a keystore through the secret DB roundtrip Adding util fn to secret namespace for converting the value to file, and adding test for that
-
Noah Moss authored
-