Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Dec 29, 2022
  2. 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
  3. Dec 15, 2022
  4. Dec 11, 2022
  5. Dec 09, 2022
    • Cam Saul's avatar
      Make Dimension unique on `field_id` and deduplicate (#27062) · 622558a1
      Cam Saul authored
      * Make Dimension unique on `field_id` and deduplicate
      
      * Fix rollback for new migrations
      
      * Don't require migration comments to contain 'added' anymore since it's part of the version ID now
      
      * Don't require 'Added <version>' in migration comments anymore
      
      * Fix SerDes test that created duplicate dimensions for one Field
      
      * Silly fix to fix MySQL 5.7
      Unverified
      622558a1
  6. 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
  7. Nov 30, 2022
  8. 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
    • Luis Paolini's avatar
  9. Nov 28, 2022
  10. Nov 08, 2022
  11. Oct 20, 2022
  12. Oct 17, 2022
  13. Sep 27, 2022
  14. Sep 22, 2022
  15. Aug 22, 2022
  16. Aug 03, 2022
  17. Jul 29, 2022
  18. Jul 22, 2022
  19. Jul 18, 2022
  20. Jul 04, 2022
  21. Jun 29, 2022
  22. Jun 16, 2022
    • jkeys089's avatar
      improved support for Google Cloud SQL (#19302) · e8368d1d
      jkeys089 authored
      
      * improved support for Google Cloud SQL
      
      * upgrade `postgres-socket-factory` and add license overrides
      
      * fix license check
      
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      Unverified
      e8368d1d
    • dpsutton's avatar
      Return non-zero output from BE i18n on error (#23373) · 47b7ac9e
      dpsutton authored
      Want to return non-zero on unrecognized forms so that CI can indicate
      when forms are added that cannot be parsed.
      
      And example of a completely valid form of `trs` that we cannot identify
      with this code is
      
      ```clojure
      ;; from driver/util.clj
      (-> "Cycle detected resolving dependent visible-if properties for driver {0}: {1}"
      
          (trs driver cyclic-props)
          (ex-info {:type               qp.error-type/driver
                    :driver             driver
                    :cyclic-visible-ifs cyclic-props})
          throw)
      ```
      
      The string literal is threaded into the `trs` macro, so it validates
      correctly but we cannot identify the literal in tooling while making the
      pot file.
      
      Now output of bin/i18n/update-translation-template would be the
      following:
      
      ```shell
      ❯ ./update-translation-template
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs.pprint.js as it exceeds the max of 500KB.
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs-runtime/cljs.core.js as it exceeds the max of 500KB.
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs.core.js as it exceeds the max of 500KB.
      ~/projects/work/metabase/bin/i18n ~/projects/work/metabase
      Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/17.0.1-zulu/zulu-17.jdk/Contents/Home
      SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
      SLF4J: Defaulting to no-operation (NOP) logger implementation
      SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
      Created pot file at  ../../locales/metabase-backend.pot
      Found 1396 forms for translations
      Grouped into 1313 distinct pot entries
      Found 1 forms that could not be analyzed
      {:file "metabase/driver/util.clj", :line 362, :original (trs driver cyclic-props), :message nil}
      
      ❯ echo $?
      1
      ```
      
      and we have an exit code of 1 so that
      https://github.com/metabase/metabase/blob/master/.github/workflows/i18n.yml
      will fail in CI.
      Unverified
      47b7ac9e
  23. Jun 10, 2022
    • Noah Moss's avatar
      Allow multi-line strings using `str` in translation macros (#22901) · 92175e0b
      Noah Moss authored
      
      * allow str form as the first argument to deferred-tru
      
      * add tests and update doc strings
      
      * migrate more setting descriptions
      
      * Handle multiline translation sources
      
      ```clojure
      enumerate=> x
      (deferred-tru
       (str
        "Whether an introductory modal should be shown after the next database connection is added. "
        "Defaults to false if any non-default database has already finished syncing for this instance."))
      enumerate=> (form->string-for-translation x)
      "Whether an introductory modal should be shown after the next database connection is added. Defaults to false if any non-default database has already finished syncing for this instance."
      ```
      
      We get the form from `(g/grasp <file> ::translate)` which returns the
      `x`. And then simply pick through it for either a string literal or a
      call to `(str <literal>+)`
      
      Co-authored-by: default avatardan sutton <dan@dpsutton.com>
      Unverified
      92175e0b
  24. Jun 08, 2022
    • dpsutton's avatar
      Create po template file (pot) from clojure (#23181) · ab2c5af3
      dpsutton authored
      * Create po template file (pot) from clojure
      
      Rather than use xgettext we can use grasp to look for translation
      sites. The reason to do this is twofold:
      
      Multiline Translated Strings
      ----------------------------
      
      We can use multiline strings in source to aide in readability. This
      [PR](https://github.com/metabase/metabase/pull/22901)
      was abandoned because we xgettext cannot be expected to combine string
      literals into a single string for translation purposes. But we can
      certainly do that with clojure code.
      
      ```clojure
      (defn- form->string-for-translation
        "Function that turns a form into the translation string. At the moment
        it is just the second arg of the form. Afterwards it will need to
        concat string literals in a `(str \"foo\" \"bar\")` situation. "
        [form]
        (second form))
      
      (defn- analyze-translations
        [roots]
        (map (fn [result]
               (let [{:keys [line _col uri]} (meta result)]
                 {:file (strip-roots uri)
                  :line line
                  :message (form->string-for-translation result)}))
             (g/grasp roots ::translate)))
      ```
      
      `form` is the literal form. So we can easily grab all of the string
      literals out of it and join them here in our script. The seam is already
      written. Then reviving the PR linked earlier would upgrade the macros to
      understand that string literals OR `(str <literal>+)` are acceptable
      clauses.
      
      Translation context
      -------------------
      
      Allowing for context in our strings. The po format allows for context in
      the file format.
      
      ```
      msgctxt "The update is about changing a record, not a timestamp"
      msgid "Failed to notify {0} Database {1} updated"
      msgstr ""
      ```
      
      See [this
      issue](https://github.com/metabase/metabase/issues/22871#issuecomment-1146947441)
      for an example situation. This wouldn't help in this particular instance
      because it is on the Frontend though.
      
      But we could have a format like
      ```clojure
      (trs "We" (comment "This is an abbreviation for Wednesday, not the
      possessive 'We'"))
      ```
      The macro strips out the `comment` form and we can use it when building
      our pot file.
      
      Note there is a difficulty with this though since all source strings
      must be unique. There can be multiple locations for each translated
      string.
      
      ```
      ,#: /metabase/models/field_values.clj:89
      ,#: /metabase/models/params/chain_filter.clj:588
      msgid "Field {0} does not exist."
      msgstr ""
      ```
      The leading commas are present to prevent commit message comments. But
      if one location has a context and the other doesn't, or even worse, if
      they have two different contexts, we have a quandry: we can only express
      one context. Probably easy to solve or warn on, but a consideration.
      
      Caught Errors
      -------------
      
      The script blew up on the following form:
      
      ```clojure
      (-> "Cycle detected resolving dependent visible-if properties for driver {0}: {1}"
          (trs driver cyclic-props))
      ```
      
      No tooling could (easily) handle this properly. Our macro assertions
      don't see the thread. But xgettext never found this translation
      literal. I warn in the pot generation so we can fix this. We could also
      have a test running in CI checking that all translations are strings and
      not symbols.
      
      Fundamental Tool
      ----------------
      
      The sky is the limit because of this fundamental grasp tool:
      
      ```clojure
      enumerate=> (first (g/grasp single-file ::translate))
      (trs "Failed to notify {0} Database {1} updated" driver id)
      enumerate=> (meta *1)
      {:line 35,
       :column 22,
       :uri "file:/Users/dan/projects/work/metabase/src/metabase/driver.clj"}
      ```
      
      We can find all usages of tru/trs and friends and get their entire form
      and location. We can easily do whatever we want after that.
      
      Verifying Translation scripts still work
      ----------------------------------------
      
      You can check a single file is valid with `msgcat <input.pot> -o
      combined.pot`. This will throw if the file is invalid.
      
      The general script still works:
      
      ```
      ❯ ./update-translation-template
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs.pprint.js as it exceeds the max of 500KB.
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs.core.js as it exceeds the max of 500KB.
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs-runtime/cljs.core.js as it exceeds the max of 500KB.
      Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/17.0.1-zulu/zulu-17.jdk/Contents/Home
      SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
      SLF4J: Defaulting to no-operation (NOP) logger implementation
      SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
      Created pot file at  ../../locales/metabase-backend.pot  #<----- new line here
      Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/17.0.1-zulu/zulu-17.jdk/Contents/Home
      2022-06-06 15:05:57,626 INFO metabase.util :: Maximum memory available to JVM: 8.0 GB
      Warning: protocol #'java-time.core/Amount is overwriting function abs
      WARNING: abs already refers to: #'clojure.core/abs in namespace: java-time.core, being replaced by: #'java-time.core/abs
      WARNING: abs already refers to: #'clojure.core/abs in namespace: java-time, being replaced by: #'java-time/abs
      2022-06-06 15:06:01,368 WARN db.env :: WARNING: Using Metabase with an H2 application database is not recommended for production deployments. For production deployments, we highly recommend using Postgres, MySQL, or MariaDB instead. If you decide to continue to use H2, please be sure to back up the database file regularly. For more information, see https://metabase.com/docs/latest/operations-guide/migrating-from-h2.html
      2022-06-06 15:06:03,594 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. :unlock:
       For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
      WARNING: abs already refers to: #'clojure.core/abs in namespace: taoensso.encore, being replaced by: #'taoensso.encore/abs
      WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.math, being replaced by: #'kixi.stats.math/abs
      WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.test, being replaced by: #'kixi.stats.math/abs
      WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.distribution, being replaced by: #'kixi.stats.math/abs
      msgcat: msgid '{0} metric' is used without plural and with plural.
      msgcat: msgid '{0} table' is used without plural and with plural.
      ```
      
      I'm not sure what the last two lines are about but I suspect they are
      preexisting conditions. their form from the final combined pot
      file (althrough again with leading commas on the filenames to prevent
      them from being omitted from the commit message)
      
      ```
      ,#: frontend/src/metabase/admin/permissions/components/PermissionsConfirm.jsx:32
      ,#: src/metabase/automagic_dashboards/core.clj
      ,#: target/classes/metabase/automagic_dashboards/core.clj
      ,#, fuzzy, javascript-format
      msgid "{0} table"
      msgid_plural "{0} tables"
      msgstr[0] ""
      "#-#-#-#-#  metabase-frontend.pot  #-#-#-#-#\n"
      "#-#-#-#-#  metabase-backend.pot (metabase)  #-#-#-#-#\n"
      msgstr[1] "#-#-#-#-#  metabase-frontend.pot  #-#-#-#-#\n"
      
      ...
      
      ,#: frontend/src/metabase/query_builder/components/view/QuestionDescription.jsx:24
      ,#: src/metabase/automagic_dashboards/core.clj
      ,#: target/classes/metabase/automagic_dashboards/core.clj
      ,#, fuzzy, javascript-format
      msgid "{0} metric"
      msgid_plural "{0} metrics"
      msgstr[0] ""
      "#-#-#-#-#  metabase-frontend.pot  #-#-#-#-#\n"
      "#-#-#-#-#  metabase-backend.pot (metabase)  #-#-#-#-#\n"
      msgstr[1] "#-#-#-#-#  metabase-frontend.pot  #-#-#-#-#\n"
      ```
      
      * Add drivers, one override, remove unused import
      
      import wasn't necessary
      forgot to check the driver sources for i18n
      for some reason grasp doesn't descend into
      
      ```clojure
      (defmacro ^:private deffingerprinter
        [field-type transducer]
        {:pre [(keyword? field-type)]}
        (let [field-type [field-type :Semantic/* :Relation/*]]
          `(defmethod fingerprinter ~field-type
             [field#]
             (with-error-handling
               (with-global-fingerprinter
                 (redux/post-complete
                  ~transducer
                  (fn [fingerprint#]
                    {:type {~(first field-type) fingerprint#}})))
               (trs "Error generating fingerprint for {0}" (sync-util/name-for-logging field#))))))
      ```
      
      I've opened an issue on [grasp](https://github.com/borkdude/grasp/issues/28)
      
      * Use vars rather than name based matching
      Unverified
      ab2c5af3
    • metamben's avatar
      Support SSL with client auth for Mongo (#22977) · cef4c19b
      metamben authored
      We have already had support for server authentication based on custom
      certificates. This change adds support for authenticating the client
      based on custom client key and certificate.
      Unverified
      cef4c19b
  25. Jun 03, 2022
    • dpsutton's avatar
      License improvements (#23120) · 3ad532b9
      dpsutton authored
      * Switch from classpath to basis for license information
      
      Previously we were chopping the classpath up and starting from there so
      we just had a sequence of strings pointing at jars. Now using the basis
      so we use a _much_ nicer map like
      
      ```clojure
      {org.bouncycastle/bcprov-jdk15on
       {:mvn/version "1.70",
        :deps/manifest :mvn,
        :dependents
        [buddy/buddy-core
         org.bouncycastle/bcutil-jdk15on
         org.bouncycastle/bcpkix-jdk15on],
        :parents
        #{[buddy/buddy-sign buddy/buddy-core]
          [buddy/buddy-sign
           buddy/buddy-core
           org.bouncycastle/bcpkix-jdk15on
           org.bouncycastle/bcutil-jdk15on]
          [buddy/buddy-sign
           buddy/buddy-core
           org.bouncycastle/bcpkix-jdk15on]},
        :paths
        ["/Users/dan/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.70/bcprov-jdk15on-1.70.jar"]}
       ...}
      
      ```
      
      So we now have a true name for the dependency, a path to it, and a
      version. No need to string munge on the classpath.
      
      * Read pom with `maven-model`
      
      rather than us trying to parse the xml, use a maven model on it. Note
      there is another level we can go to that would be aware of parent poms
      but we don't need the overkill here. That's far heavier than what we
      need to do in this instance.
      
      Note this also reorders the algo:
      previously
      - license in jar
      - backfill
      - license from pom
      
      Now:
      - license from jar
      - license from pom
      - backfill
      
      Possible we will want to actually just skip the license from pom bit
      since it only gives us a name and a url and not the full text. We could
      match on these and identify them with the resources used from the
      backfill if we like.
      
      Another important change is that this no longer throws if it cannot find
      a pom for a jar. This came up for the following lib:
      
      ```
      ;; deps.edn
      com.google.cloud.sql/postgres-socket-factory
      {:mvn/version "1.6.0"} ; Secure Google Cloud SQL postgres connections
      
      ;; override:
      "com.github.jnr"             {"jffi$native" {:resource "apache2_0.txt"}}
      ```
      Which was from a 3rd party PR.
      
      * Way to generate libs that need overrides
      
      * Remove unused fns, add tests, cleanup docstring
      
      * Don't leave tap> in
      
      Two poms blow up with BOM errors
      
      - jakarta.activation-1.2.1.pom
      - jakarta.activation-api-1.2.2.pom
      
      > UTF-8 BOM plus xml decl of iso-8859-1 is incompatible
      > (position: START_DOCUMENT seen <?xml version="1.0" encoding="iso-8859-1"... @1:41)
      
      It has a parent pom and not a license so we wouldn't find it anyways.
      Unverified
      3ad532b9
  26. May 24, 2022
  27. May 13, 2022
    • Case Nelson's avatar
      Upgrade build-drivers to Clojure 1.11.1 (#22709) · 5ae6f212
      Case Nelson authored
      Addressing
      Running clj -X:deps tree in bin/build-drivers the cli version is getting picked up
      as I switched clojure-cli versions between 1.11 and 1.10.
      
      I think this is because including metabase/metabase-core as a local/root no longer
      places the clojure dep within it at the top level.
      
      Now, the docs say
      > It is a top dep (top dep versions always win) or it is a new lib or a newer version of a known lib (Maven keeps only the first found version regardless of new/old)
      
      And so I would expect to see org.clojure/clojure in the deps tree under
      metabase/metabase-core but it's missing, which to me means clojure maybe treated
      specially if the root deps don't specify it.
      Unverified
      5ae6f212
  28. May 04, 2022
  29. Apr 22, 2022
    • adam-james's avatar
      Handle Plural Translation and Path String Bugs for i18n (#21116) · b0ff7087
      adam-james authored
      The i18n in Metabase uses a service 'POEditor', which requires:
      
      1. all strings on the frontend and backend that need to have translations must be collected into a .pot file
      2. The .pot file is uploaded and people contribute translations for each phrase, per locale. These eventually get
      downloaded as locale.po (eg. German is 'de.po')
      3. Frontend and backend each take responsibility for generating required locale resources, which are then used to
      render the correct translations for the user's locale in the app.
      
      This process works just fine, but occasionally some bugs are found. These particular changes in this PR were found
      because of issue #15660 where a user reports that some of the 'binning options' are translated while others are not.
      
      Those particular strings originate form the backend via the API at `src/metabase/api/table.clj`, but the issue arises
      because the backend's locale resource files do not contain the entries for those translations. The mechanism is
      working just fine, it's the resource building process that has some issues.
      
      So, we can turn to the i18n build process, which is all found in `bin/i18n`, and is a mix of shell scripts and
      clojure.
      
      The script `update-translation-template` starts the process.
      There are a few steps in the process:
      
      1. generate metabase-frontend.pot -> uses Babel, I'm assuming this works for the purpose of this PR
      
      2. generate metabase-backend.pot  -> works fine. We can see in `locales/metabase-backend.pot`:
      
         #: src/metabase/api/table.clj
         msgid "Week"
         msgstr ""
      
      3. Join these files together with a tool 'msgcat' into metabase.pot
         - here is where we begin to see an issue.
         - there is NO entry that matches the example from 2. This is because msgcat has combined translation strings that
         match on the frontend into a single entry:
      
           #: frontend/src/metabase-lib/lib/Dimension.ts:1677
           #: frontend/src/metabase/lib/query_time.js:203
           #: frontend/src/metabase/parameters/components/widgets/DateRelativeWidget.jsx:25
           #: frontend/src/metabase/parameters/components/widgets/DateRelativeWidget.jsx:30
           #: src/metabase/api/table.clj
           msgid "Week"
           msgstr ""
      
         - and, more interestingly:
      
         #: frontend/src/metabase-lib/lib/Dimension.ts:1689
         #: frontend/src/metabase/lib/query_time.js:207 src/metabase/api/table.clj
         msgid "Quarter"
         msgstr ""
      
         - There are a bunch of #: lines, the last being the clj file, which means that "Week" is used both in the frontend
         and backend. So, the translated string can be used in both situations. The backend does handle the case of multiple
         #: paths, but does not handle the second situation, where there are actually 2 paths (space separated) in a single
         #: line.
      
      4. in the file `bin/i18n/src/create_artifacts/backend.clj` we create .edn files for each locale.
         - this is a map where the keys are the English strings and values are the translations from the locale.po file.
         - our logic in this file incorrectly assumes only a single path per #: line in the .pot file exists, and this is
         one place where things break. The 'backend-message?' predicate will fail on the second example in 3. so we don't
         ever translate that string.
         - Simultaneously, `i18n/common.clj` allows pluralized entries. In the case of "Week", we got "Week" and "Weeks"
         translated from POEditor. When a message is plural, the contents show up in a different location. Our backend code
         ignores plural, but this ends up throwing away our valid translation as well. When a message is plural, all
         translations show up in :str-plural as a seq, where the first entry is the singular translation. But, we (remove
         :pluarl?) so get nothing. This is why the binning options aren't translated. As a point of completeness: if a
         message has no plural, we correctly get the translated message from the :str key.
      
      The broken logic:
      - common.clj - po-messages-seq creates a seq of messages, where a message looks like:
      {:id "Week",
        :id-plural "Weeks",
        :str nil,
        :str-plural ("Woche" "Wochen"),
        :fuzzy? false,
        :plural? true,
        :source-references
        ("frontend/src/metabase/lib/query_time.js:203"
         "frontend/src/metabase/parameters/components/widgets/DateRelativeWidget.jsx:25"
         "frontend/src/metabase/parameters/components/widgets/DateRelativeWidget.jsx:30"
         "src/metabase/api/table.clj target/classes/metabase/api/table.clj"),
        :comment nil}
      
      or
      {:id "Day of Week",
        :id-plural nil,
        :str "Wochentag",
        :str-plural nil,
        :fuzzy? false,
        :plural? false,
        :source-references ("src/metabase/api/table.clj target/classes/metabase/api/table.clj"),
        :comment nil}
      
      Example 1 fails because the message is pluralized. :str is nil, but (first (:str-plural message)) has the correct
      translation. We are looking in the wrong spot in this case. Compare to Example 2 which does work.
      
      Notice a subtle thing that was actually wrong in examples 1 and 2 but worked by accident: some :source-references
      strings contain 2 paths. We see this failing here:
      
      {:id "Quarter",
       :id-plural "Quarters",
       :str nil,
       :str-plural ("Quartal" "Quartale"),
       :fuzzy? false,
       :plural? true,
       :source-references
       ("frontend/src/metabase/lib/query_time.js:207 src/metabase/api/table.clj" "target/classes/metabase/api/table.clj"),
       :comment nil}
      
      We can solve this different problem by using str/split in the backend-message? predicate.
      Unverified
      b0ff7087
  30. Apr 19, 2022
    • Braden Shepherdson's avatar
      Make namespace aliasing consistent everywhere; enforce with clj-kondo (#21738) · 19beda53
      Braden Shepherdson authored
      * Make namespace aliasing consistent everywhere; enforce with clj-kondo
      
      See the table of aliases in .clj-kondo/config.edn
      
      Notable patterns:
      - `[metabase.api.foo :as api.foo]`
      - `[metabase.models.foo :as foo]`
      - `[metabase.query-processor.foo :as qp.foo]`
      - `[metabase.server.middleware.foo :as mw.foo]`
      - `[metabase.util.foo :as u.foo]`
      - `[clj-http.client :as http]` and `[metabase.http-client :as client]`
      
      Fixes #19930.
      Unverified
      19beda53
  31. Apr 07, 2022
  32. Mar 14, 2022
    • Cam Saul's avatar
      Upgrade Liquibase to latest version; remove final Java source file and need... · aaf1b601
      Cam Saul authored
      Upgrade Liquibase to latest version; remove final Java source file and need for `clojure -X:deps prep` (#20611)
      
      * Upgrade Liquibase to latest version
      
      * Try adjusting log
      
      * Fix checksums for the TWO migrations with ID = 32
      
      * FINALLY get Liquibase to use Log4j2
      
      * Set Liquibase ConsoleUIService OutputStream to null OutputStream
      
      * Manually define a package for our H2 proxy class so Java 8 works
      
      * Fix package-name determination code
      
      * Update migrations file spec
      
      * `databasechangelog` shouldn't be upper-case
      
      * Lower-case quartz table names
      
      * More MySQL fixes :wrench:
      
      * Properties for all the Quartz tables :cry:
      
      * Formatting tweaks [ci skip]
      
      * Revert a few more busted changes
      
      * Fix more busted changes
      
      * Bump Liquibase version to 4.8.0 to fix MySQL defaultValueBoolean bug
      
      * OMG I think I finally fixed MySQL
      
      * Remove Java source file and prep-deps code
      
      * Remove two more references to bin/prep.sh
      
      * Minor cleanup
      
      * Revert unneeded changes
      
      * Fix busted indentation
      
      * Don't search inside java/ anymore since it's G-O-N-E
      
      * Appease the namespace linter
      
      * Update src/metabase/db/liquibase/h2.clj
      Unverified
      aaf1b601
  33. Feb 16, 2022
  34. Feb 15, 2022
    • Cam Saul's avatar
      Upgrade Hive JDBC driver version from 1.2.2 -> 3.1.2; Bump Spark SQL from 2.1.1 to 3.2.1 (#20353) · 4dc16403
      Cam Saul authored
      * Replace AOT Spark SQL deps with a `proxy` and a `DataSource`
      
      * Support `connection-details->spec` returning a `DataSource`
      
      * Remove target/classes
      
      * Don't need to deps prep drivers anymore
      
      * Fix duplicate `this` params in `proxy` methods; add `:test` alias for Eastwood to make it be a little quieter
      
      * Make sure to call `pool/map->properties`
      
      * Upgrade Hive JDBC driver version from 1.2.2 -> 3.1.2; Bump Spark SQL from 2.1.1 to 3.2.1
      
      * Clean the namespaces
      
      * Don't need to register the a proxy JDBC driver since we're not even using it anymore
      
      * Fix Spark SQL :schema sync for newer versions
      
      * Remove unneeded override
      
      * Fix day-of-week extract for new :sparksql
      
      * Hive/Spark SQL needs to escape question marks inside QUOTED identifiers now :unamused:
      
      * Some minor SQL generation improvements to avoid duplicate casts
      
      * Revert change to debug test
      Unverified
      4dc16403
Loading