Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Feb 20, 2023
  2. Feb 17, 2023
  3. Feb 15, 2023
  4. Feb 14, 2023
    • Braden Shepherdson's avatar
      [metabase-lib] PoC for wrapping JS objects with cljs-bean in CLJC · 4c15f80c
      Braden Shepherdson authored
      A `metabase.domain-entities.malli/defn` macro that (in CLJS) uses the
      schemas for the arguments to drive wrapping of vanilla JS objects for
      idiomatic use in CLJC code.
      
      See the first two functions in `metabase.domain-entities.queries.util`
      which get passed vanilla JS objects but can use them as CLJS maps.
      4c15f80c
  5. Feb 13, 2023
  6. Feb 09, 2023
    • dpsutton's avatar
      Fix for toucan2 laziness in hydration (#28201) · ea0d4329
      dpsutton authored
      https://github.com/camsaul/toucan2/pull/126
      
      Editing the data model loads a _lot_ of data. It hits the following form
      from the api:
      
      ```clojure
      (hydrate [:tables [:fields [:target :has_field_values]
                         :has_field_values] :segments :metrics])
      ```
      
      On my test instances, with 1500 tables each with 14 fields: 15mb and 359
      tables each with 14 fields: 3.69mb. Not great.
      
      If you want to recreate, create an empty db, sync it, then
      
      ```clojure
        (time
         (let [conn (sql-jdbc.conn/db->pooled-connection-spec 3)]
           (dotimes [n 359]
             (jdbc/execute! conn [(format "create table if not exists foo_%d (id int, col_1 text, col_2 text, col_3 text, col_4 text, col_5 text, col_6 text, col_7 text, col_8 text, col_9 text, col_10 text, col_11 text, col_12 text, col_13 text, col_14 text)" n)]))))
      
        (sync/sync-database! (db/select-one 'Database :id 3) {:scan :schema})
      
        (binding [api/*current-user-permissions-set* (delay #{"/"})]
          (count (#'metabase.api.database/db-metadata 3 true true)))
      ```
      
      And the source of the bug was a classic recur with a lazy concat.
      
      ```diff
      diff --git a/src/toucan2/tools/hydrate.clj b/src/toucan2/tools/hydrate.clj
      index e1d0459..10c9c49 100644
      --- a/src/toucan2/tools/hydrate.clj
      +++ b/src/toucan2/tools/hydrate.clj
      @@ -456,7 +456,7 @@
           (if (empty? hydrated-instances)
             (concat acc (map :instance annotated-instances))
             (let [[not-hydrated [_needed-hydration & more]] (split-with (complement :needs-hydration?) annotated-instances)]
      -        (recur (concat acc (map :instance not-hydrated) [(first hydrated-instances)])
      +        (recur (vec (concat acc (map :instance not-hydrated) [(first hydrated-instances)]))
                      more
                      (rest hydrated-instances))))))
      
      ```
      Unverified
      ea0d4329
    • Mark Bastian's avatar
      Upgrading ring jetty adapter to ring-jetty9-adapter (and Jetty 11) (#28137) · eda2b042
      Mark Bastian authored
      Upgrade to Jetty 11 via https://github.com/sunng87/ring-jetty9-adapter. Required updating from javax servlet packages to jakarta, since jakarta is newer.
      Unverified
      eda2b042
  7. Feb 08, 2023
  8. Feb 07, 2023
  9. Feb 01, 2023
  10. Jan 20, 2023
    • Bryan Maass's avatar
      Data graph permissions decoding -- removing redundancies (#27665) · a93aa967
      Bryan Maass authored
      This work removes a spec and a p.schema for data graph permissions.
      
      There are still some specs but they are for execution, and collection graph permissions. Those should be targeted next.
      
      * decoded + verified FIXME
      
      * still good
      
      * some cleanup
      
      * a little more cleaning up
      
      * bit more cleaning
      
      * converted update-group-permissions! -> mu/defn
      
      * use the correct shape for new-group-perms
      
      * remove bunch of pschemas
      
      * linter appeasement
      
      * update test for setting dissallowed schema
      
      * respond to review comments
      
      * fix some tests + improve mu/defn error messages
      
      * a lint fix
      
      * lint fix
      
      * read and query are optional
      
      * update expected error message to the improved one
      
      * stop calling trs at the top level
      
      * fix function signature
      
      * improve test
      Unverified
      a93aa967
  11. Jan 18, 2023
  12. Jan 11, 2023
  13. Jan 03, 2023
  14. Dec 26, 2022
  15. Dec 21, 2022
    • john-metabase's avatar
      Start-of-cycle 46 basic dependency version bump (#27332) · 704a1c54
      john-metabase authored
      * Start-of-cycle 46 basic dependency version bump
      
      Some dependencies with available major version bumps are only updated
      to the latest minor version of the current major version. Some
      additional dependencies will be updated in future PRs.
      
      * Removes commons-lang from sparksql deps exceptions
      
      * Fixes MongoDB SRV test for monger 3.6.0
      
      * fixes SQLite datetime tests for new driver version 3.40
      Unverified
      704a1c54
  16. Dec 16, 2022
  17. Dec 13, 2022
  18. Dec 09, 2022
  19. Dec 08, 2022
    • Cam Saul's avatar
      Add `=?` test expression type (#23982) · 43236c0a
      Cam Saul authored
      
      * ≈ [WIP] [ci skip]
      
      * Minor cleanup [ci skip]
      
      * Code cleanup. [ci skip]
      
      * Kondo in CI should fetch library configs
      
      * Bump Methodical version
      
      * Change name to `=?`
      
      * Add `#exactly` reader tag
      
      * Add `#schema` data reader
      
      * Fix dev deps indentation and add `algo.generic`
      
      * Add `approx=`
      
      * Improved version of `#approx`
      
      * Just check in third party Kondo config for now instead of fighting CI
      
      * Update test/metabase/test_runner/assert_exprs/approximately_equal_test.clj
      
      Co-authored-by: default avatarTim Macdonald <tim@metabase.com>
      
      * Address PR feedback and fix sequence comparison
      
      Co-authored-by: default avatarTim Macdonald <tim@metabase.com>
      Unverified
      43236c0a
  20. Dec 06, 2022
  21. Dec 02, 2022
  22. Nov 29, 2022
    • Cam Saul's avatar
      Athena driver (#26301) · a32bb77b
      Cam Saul authored
      * Include Amazon Athena support for dacort/metabase-athena-driver
      
      * Use Metabase Maven repo to fetch Athena driver
      
      * Copy test extensions from Damon's Athena driver repo
      
      * Some code cleanup.
      
      * Move namespaces => metabase.driver.athena
      
      * Clean up the test extensions namespace
      
      * 42 failures, 16 errors
      
      * Fix regex support; disable a few tests
      
      * Minor tweaks
      
      * Fix data-source-name
      
      * Fix :week and :day-of-week impls (mostly): 2 failures, 3 errors
      
      * Fix OFFSET, :week-of-year; skip test that has TIME column
      
      * Add Athena to CircleCI config. Don't wait for Java 11 tests to finish before driver tests.
      
      * ALL TESTS ARE PASSING! <3
      
      * Copy fixes for https://github.com/dacort/metabase-athena-driver/issues/115;
      
       add test
      
      * We don't need to prep source files or fetch dependencies before running backend tests.
      
      * Fix Eastwood error.
      
      * Tweak CircleCI config.
      
      * Fix TIMESTAMP WITH TIME ZONE
      
      * Include the Athena/Redshift repos in the build-drivers deps.edn
      
      * Build and release scripts need to have the :mvn/repos as well
      
      * Revert change that enabled test for Presto
      
      * Un-enable failing test for Snowflake as well.
      
      * moves all is clauses into the test
      
      - previously only the first few tests were being run
      
      * Sort ns in `metabase.driver.athena-test`
      
      * Prevent athena's log4j2.properties file from becoming log config
      
      athena includes log4j2.properties top-level with the properties:
      
      ```
      status = debug
      rootLogger.level=debug
      ```
      
      And this kills our beautifully crafted logging. Set
      "log4j2.configurationFile" in bootstrap to our own log4j2.xml.
      
      Log4j2 looks in a few places for its logging config, the first of which
      is the properties file. So when the jar is loaded, log4j2 considers this
      a logging config change and we lose our logging.
      
      Co-authored-by: default avatarDamon P. Cortesi <d.lifehacker@gmail.com>
      Co-authored-by: default avatarBryan Maass <bryan.maass@gmail.com>
      Co-authored-by: default avatardan sutton <dan@dpsutton.com>
      Unverified
      a32bb77b
    • Ngoc Khuat's avatar
  23. Nov 16, 2022
    • dpsutton's avatar
      Initial support for datetimeDiff (#25722) · 254e73f8
      dpsutton authored
      
      * Initial support for pg for `date-diff`
      
      * Make the useful-dates closer to one day
      
      * Add simple FE stuff
      
      * shorter test bodies
      
      * Ensure we can use datediff functions in arithmetic expressions
      
      * Correctly disable datediff for redshift
      
      * simplify var names
      
      * Support week
      
      * cleanup test
      
      * :datediff -> :datetimediff
      
      * ngoc's suggestions
      
      * Better acceptance test for datetimediff
      
      * sort ns
      
      * embrace the different cases for results
      
      * bigquery day month year
      
      * Reverse args
      
      * Update test
      
      * Centralize tests
      
      * Change postgres day, month, year behaviour
      
      * Refactor keep identity
      
      * Tidy tests
      
      * Tidy
      
      * Fix bigquery week
      
      * Add week tests
      
      * Fix bigquery week
      
      * Change mysql day, month, year behaviour
      
      * Add test for hour, minute, second
      
      * Fix postgres hour minute second
      
      * Formatting
      
      * Fix bigquery hour, minute, second
      
      * Formatting
      
      * Fix postgres timestamptz
      
      * WIP
      
      * Allow literals in datediff clauses
      
      * Uncomment tests
      
      * Fix bigquery when reporting timezone is not UTC
      
      * Linting
      
      * Moving away from dataset based tests
      
      * Add timezone tests for week and tidy
      
      * Remove unused import
      
      * Consolidate tests
      
      * Remove with-time-column dataset
      
      * Remove more-useful-dates defdataset
      
      * Remove redshift driver WIP
      
      * Typo
      
      * Move DatetimeLiteral clause into DateTimeExpressionArg
      
      * Try changing test order
      
      * Remove mt/with-report-timezone-id nil
      
      * Add year report timezone tests
      
      * Rename
      
      * Rename
      
      * Remove unused tables from useful-dates
      
      * Remove useful-dates
      
      * Update helper-text-strings
      
      * Tidy
      
      * Swap order of mt/with-report-timezone-id
      
      * Change with-report-timezone-id; notify databases after running test
      
      * Use temp setting for report-timezone instead
      
      * Update helper-test-strings
      
      * Handle literals in `datetimediff-base-base`
      
      * Update src/metabase/driver/postgres.clj
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Simplify postgres second
      
      * Tidy: prefer hx arithmetic functions
      
      * Drop coercion for string timestamp args for now
      
      * Extract helper
      
      * Revert "Change with-report-timezone-id; notify databases after running test"
      
      This reverts commit 7abb543bed13d9d13295d0e00ad1293a40e40d53.
      
      * Use ->timestamptz
      
      * Use hx/->timestamp
      
      * Rename dataset
      
      * Undo changes to datetime-arithmetics? as these will not match by default
      
      * Use proper format for offset datetime literals
      
      * Shorten datetime literals in tests
      
      * Removing notify-all-databases-updated from report-timezone setting
      
      * Fix datetime-arithmetics test
      
      * Revert "Fix datetime-arithmetics test"
      
      This reverts commit 9141582508170bdbe99c4aa74bc4444e41475be6.
      
      * Revert "Undo changes to datetime-arithmetics? as these will not match by default"
      
      This reverts commit 9cb05f5475b24a78cb89601c918f3440606cc525.
      
      * Add UTC timezone to tests
      
      * Coerce strings to datetimes for ISO formats
      
      * Revert "Removing notify-all-databases-updated from report-timezone setting"
      
      This reverts commit 37356435a2e3981deca9ae76118d857babb2aada.
      
      * Add comment to postgres driver implementation
      
      * Formatting
      
      * Disable datediff from redshift for the moment (for ever?)
      
      * Override redshift driver/database-supports?
      
      * Fix comments mixed up by refactoring
      
      * Fix comments mixed up by refactoring 2
      
      * Tidy comment
      
      * Rename datetimediff to datetime-diff/datetimeDiff
      
      * date-add -> datetime-add
      
      * Linting
      
      * add datetime-subtract to `datetime-arithmetics?`
      
      rework tests a bit as well.
      
      * Update docstring
      
      * Use ->temporal-type and trunc to handle report-timezone for bigquery
      
      * Log errors caught during sync steps (#26306)
      
      * log errors caught during sync steps
      
      * remove accidental extra parens
      
      * Errors combining datetime interval addition with datetime functions (#26279)
      
      * Add failing tests
      
      * Fix failing tests
      
      * Update shared/src/metabase/mbql/util.cljc
      
      Co-authored-by: default avatarNgoc Khuat <qn.khuat@gmail.com>
      
      * datetime-add and datetime subtract should annotate type by col type
      
      * Fix infer-expression-type for datetime-add/subtract with second, minute, hour
      
      * Undo last commit; they actually always return :type/DateTime
      
      * Fix test based on last commit
      
      * Undo unrelated refactor
      
      * Only test drivers that support expressions
      
      * Only test drivers that support expressions, again
      
      * Update tests from legacy mbql
      
      * Change infered-col-type to be a function again, not macro
      
      * Fix test
      
      Co-authored-by: default avatarNgoc Khuat <qn.khuat@gmail.com>
      
      * whitespace
      
      * Remove comments
      
      * Add explanation for datetime_diff
      
      * Refactor: replace cast and add `mt/with-driver :bigquery-cloud-sdk` where report-timezone is relevant
      
      * Add failing tests
      
      * Fix failing tests
      
      * Technically it should be bigquery-type
      
      * Update modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj
      
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      
      * Move documentation to metabase.mbql.schema
      
      * Update DatetimeDiffUnits
      
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      
      * Add error type and optimize case expressions to driver implementations
      
      * refactor for brevity
      
      * Fix error with postgres
      
      * Fix error with postgres
      
      * Handle string literal parsing in wrap-value-literals
      
      * Remove ->timestamptz
      
      * Add comments + TODOs showing arithmetic expressions should return numeric values
      
      * Add explanation of arithmetic expression as docstring
      
      * Add test for normalize-mbql-clause-tokens
      
      * Remove unused import
      
      * Remove unused form
      
      * Switch tests to use attempted-murders dataset
      
      * Undo optimization that broke tests
      
      * Validate non-temporal types for bigquery
      
      * Add error handling for incorrect types
      
      * Fix mysql type checking
      
      * Fix mysql type checking
      
      * invalid-parameter -> invalid-query
      
      * Use date-trunc and extract
      
      * Remove unit error handling
      
      * DatetimeLiteral -> DateOrDatetimeLiteral
      
      * Remove unused binding
      
      * Fix mysql type checking
      
      Co-authored-by: default avatarCallum Herries <hi@callumherries.com>
      Co-authored-by: default avatarCal Herries <39073188+calherries@users.noreply.github.com>
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      Co-authored-by: default avatarNoah Moss <32746338+noahmoss@users.noreply.github.com>
      Co-authored-by: default avatarNgoc Khuat <qn.khuat@gmail.com>
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      Unverified
      254e73f8
  24. Nov 09, 2022
  25. Nov 08, 2022
  26. Nov 07, 2022
    • dpsutton's avatar
      Bump woodstox : CVE-2022-40151 (#26269) · 84df58aa
      dpsutton authored
      First seen in trivy report:
      https://github.com/metabase/metabase/pull/26161/checks?check_run_id=9326286850
      
      CVE:
      https://avd.aquasec.com/nvd/cve-2022-40151
      
      xstream: Xstream to serialise XML data was vulnerable to Denial of
      Service attacks High
      Package: com.fasterxml.woodstox:woodstox-core
      Installed Version: 6.2.6
      Vulnerability CVE-2022-40151
      Severity: HIGH
      Fixed Version: 5.4.0, 6.4.0
      
      Bumping deps and comparing `clj -X:deps tree` shows the change only adds
      the new dep top level and no new deps are brought in by the change.
      
      ```
      ❯ diff --unified deps deps-updated
      --- deps	2022-11-07 08:43:21.000000000 -0600
      +++ deps-updated	2022-11-07 08:49:56.000000000 -0600
      @@ -9,6 +9,8 @@
         X org.slf4j/slf4j-api 1.7.25 :use-top
         X org.apache.logging.log4j/log4j-api 2.18.0 :use-top
         X org.apache.logging.log4j/log4j-core 2.18.0 :use-top
      +com.fasterxml.woodstox/woodstox-core 6.4.0
      +  . org.codehaus.woodstox/stax2-api 4.2.1
       joda-time/joda-time 2.10.13
       commons-codec/commons-codec 1.15
       weavejester/dependency 0.2.1
      @@ -285,8 +287,7 @@
         . org.apache.santuario/xmlsec 2.3.0
           X org.slf4j/slf4j-api 1.7.32 :use-top
           X commons-codec/commons-codec 1.15 :use-top
      -    . com.fasterxml.woodstox/woodstox-core 6.2.6
      -      . org.codehaus.woodstox/stax2-api 4.2.1
      +    X com.fasterxml.woodstox/woodstox-core 6.2.6 :use-top
           . jakarta.xml.bind/jakarta.xml.bind-api 2.3.3
             . jakarta.activation/jakarta.activation-api 1.2.2
         . org.opensaml/opensaml-xmlsec-api 3.4.6
      ```
      Unverified
      84df58aa
  27. Oct 20, 2022
    • Cam Saul's avatar
      Initialize Metabase with config from a file (#25986) · 5625fcb1
      Cam Saul authored
      
      * Initialize Metabase from a file
      
      * Code cleanup
      
      * Support optional template tags; more dox
      
      * Finish documentation for ns str
      
      * Force the first User to be an admin
      
      * Tests for DB creation
      
      * Add test to ensure that you can set User password with an {{env ...}} template
      
      * Remove data app permission code (#26016)
      
      * Revert "Use "apps" collection namespace for app collections (#25963)"
      
      This reverts commit a1894202.
      
      * Revert "Implement EE/Pro app permissions (#25764)"
      
      This reverts commit cf9b1bf5.
      
      * Revert "Implement global app permissions for the "All Users" group (#25679)"
      
      This reverts commit 63e950f2.
      
      * Revert "Require data permissions for executing actions (#25784)"
      
      This reverts commit 732bf6b1.
      
      * Revert "Prevent modifying app permissions via the collection endpoint (#25684)"
      
      This reverts commit 5d3f8279.
      
      * Revert "Implement DB specific execution permissions (#25629)"
      
      This reverts commit 141a13ce.
      
      * Revert "Introduce /execution/ permission (#25529)"
      
      This reverts commit 57cbb921.
      
      * Keep the app permission revision table
      
      * [Apps] Remove emitters (#25999)
      
      * [Apps] Remove emitters
      
      Emitters were created when we thought that we would be adding actions to
      multiple places in metabase. Instead we've coalesced to actions being a
      core feature of data-apps and are executed from within them. Attaching
      actions to models, as a form of re-use rather than a form of execution,
      means that actions can still be executed directly from a model, if we
      want to allow that in the future.
      
      * Fix lint errors
      
      * Move perform-action! tests out of the api.
      
      Since we want to keep the implicit bulk functionality but remove those
      endpoints move the tests to the actions namespace.
      
      * Fix linter
      
      * Change driver test to use function instead of endpoint
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      Co-authored-by: default avatarCase Nelson <case@metabase.com>
      Unverified
      5625fcb1
  28. Sep 26, 2022
  29. Sep 22, 2022
  30. Sep 19, 2022
    • dpsutton's avatar
      initial prometheus sketch (#25149) · 00530c98
      dpsutton authored
      * initial prometheus sketch
      
      need env variable to start: MB_PROMETHEUS_SERVER_PORT=9191
      
      sample of output:
      
      ```
      '# HELP jvm_threads_current Current thread count of a JVM
      '# TYPE jvm_threads_current gauge
      jvm_threads_current 81.0
      '# HELP jvm_threads_daemon Daemon thread count of a JVM
      '# TYPE jvm_threads_daemon gauge
      jvm_threads_daemon 36.0
      '# HELP jvm_threads_peak Peak thread count of a JVM
      '# TYPE jvm_threads_peak gauge
      jvm_threads_peak 81.0
      '# HELP jvm_threads_started_total Started thread count of a JVM
      '# TYPE jvm_threads_started_total counter
      jvm_threads_started_total 104.0
      '# HELP jvm_threads_deadlocked Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers
      '# TYPE jvm_threads_deadlocked gauge
      jvm_threads_deadlocked 0.0
      ```
      
      request:
      
      ```
      ❯ http localhost:9191/metrics
      HTTP/1.1 200 OK
      Content-Length: 7329
      Content-Type: text/plain; version=0.0.4; charset=utf-8
      Date: Wed, 31 Aug 2022 16:13:38 GMT
      Server: Jetty(9.4.48.v20220622)
      
      '# HELP jvm_gc_collection_seconds Time spent in a given JVM garbage collector in seconds.
      '# TYPE jvm_gc_collection_seconds summary
      jvm_gc_collection_seconds_count{gc="G1 Young Generation",} 41.0
      jvm_gc_collection_seconds_sum{gc="G1 Young Generation",} 0.586
      jvm_gc_collection_seconds_count{gc="G1 Old Generation",} 0.0
      jvm_gc_collection_seconds_sum{gc="G1 Old Generation",} 0.0
      '# HELP jvm_threads_current Current thread count of a JVM
      '# TYPE jvm_threads_current gauge
      ```
      
      * Log on unparseable prometheus port
      
      * Clean up prometheus and save test
      
      * typehint
      
      * Jetty collector
      
      * Reset system to nil when shutting down
      
      * c3p0 stats
      
      * Clean up, document, and add tests
      
      * Error message for failure to bind to port
      
      Starting up with prometheus port set to the main webserver port to get
      the error:
      
      ```
      MB_JETTY_PORT=3006 MB_DB_CONNECTION_URI="postgres://..." \
      MB_PROMETHEUS_SERVER_PORT=3006 java -jar locally-built.jar
      ```
      yields the following error:
      
      ```shell
      2022-09-09 10:08:52,000 INFO metabase.core :: Setting up prometheus metrics
      2022-09-09 10:08:52,002 INFO metabase.prometheus :: Starting prometheus metrics collector
      2022-09-09 10:08:52,016 INFO metabase.prometheus :: Starting prometheus metrics web-server on port 3,006
      2022-09-09 10:08:52,036 ERROR metabase.core :: Metabase Initialization FAILED
      clojure.lang.ExceptionInfo: Failed to initialized Prometheus on port 3,006 {:port 3006}
      [stacktrace ...]
      Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:3006
      [stacktrace ...]
      Caused by: java.net.BindException: Address already in use
      ```
      
      * Test for error message
      
      * Move prometheus to analytics folder
      
      * Str port so log does not add commas to number
      
      eg:
      > Starting prometheus metrics web-server on port 9,191
      
      * make some test functions private
      
      * docstring on defsetting
      
      * align lets
      
      * ns docstring changes
      
      include the env variable for ease of understanding
      
      * sort ns
      
      * remove some reflection warnings
      
      * reorder FE lines due to some new linter
      
      * Cleanup: i18n descriptions, typo, List/of
      
      * bit more concise c3p0 collection
      
      * no longer need the helper `->array`
      
      * clean up doseq for c3p0 measurements
      Unverified
      00530c98
  31. Sep 13, 2022
  32. Sep 07, 2022
Loading