Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. 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
  2. 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
  3. 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
  4. 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
  5. May 24, 2022
  6. 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
  7. May 04, 2022
  8. 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
  9. 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
  10. Apr 07, 2022
  11. 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
  12. Feb 16, 2022
  13. 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
  14. Feb 08, 2022
    • Luis Paolini's avatar
      Fix locking in new Alpine release container (#20298) · 860ef3fa
      Luis Paolini authored
      * Fix locking in new Alpine release container
      Seems like the new Alpine container (3.15) has some issue when doing apk upgrade first which ends up erroring out the process, so moving it to the last part of the process (after installing the packages) makes the trick.
      You can test it out by using the current process (errors with a "Unable to lock database: temporary error (try again later)") and the one in this branch which will finish successfully
      Unverified
      860ef3fa
  15. Feb 03, 2022
  16. Feb 01, 2022
  17. Jan 26, 2022
    • Ariya Hidayat's avatar
    • Jeff Evans's avatar
      Support overriding ROWCOUNT for SQL Server (#19267) · 802cc236
      Jeff Evans authored
      * Support overriding ROWCOUNT for SQL Server
      
      Add new "ROWCOUNT Override" connection property for `:sqlserver`, which will provide a DB-level mechanism to override the `ROWCOUNT` session level setting as needed for specific DBs
      
      Change `max-results-bare-rows` from a hardcoded constant to a setting definition instead, which permits a DB level override, and move the former constant default to a new def instead (`default-max-results-bare-rows`)
      
      For `:sqlserver`, set the DB-level setting override (if the connection property is set), via the `driver/normalize-db-details` impl
      
      Add test to confirm the original scenario from #9940 works using this new override (set to `0`)
      
      Move common computation function of overall row limit to the `metabase.query-processor.middleware.limit` namespace, and invoke it from execute now, called `determine-query-max-rows`
      
      Add new clause to the `determine-query-max-rows` function that preferentially takes the value from `row-limit-override` (if defined)
      Unverified
      802cc236
  18. Jan 25, 2022
  19. Jan 21, 2022
  20. Jan 20, 2022
  21. Jan 12, 2022
    • Jeff Evans's avatar
      Sync multiple schemas for BigQuery (#19547) · 526594f4
      Jeff Evans authored
      Add functions to describe-database namespace for performing inclusive/exclusive schema filtering
      
      Add tests for these functions in isolation
      
      Update `:bigquery-cloud-sdk` driver and QP code to remove the single `dataset-id` conn-param
      
      Changing :bigquery-cloud-sdk` driver to use dataset inclusion/exclusion filters instead
      
      Updating `add.cy.spec.js` Cypress test to account for new structure
      
      Add data upgrade (via `driver/normalize-db-details` implementation) to change `dataset-id` property to inclusion filter
      
      Add test to confirm data upgrade
      
      Adding server side expansion of `:schema-filters` type connection property
      Unverified
      526594f4
  22. Jan 03, 2022
  23. Dec 30, 2021
  24. Dec 28, 2021
  25. Dec 26, 2021
  26. Dec 17, 2021
  27. Dec 07, 2021
    • Jeff Evans's avatar
      Add linter for metabase-plugin.yaml files (#19240) · 61828f4e
      Jeff Evans authored
      Add new deps for finding close misspellings of map keys (spell-spec) and printing more readable spec errors (expound)
      
      Adding spec definitions for driver YAML format
      
      Add call to driver YAML validation from verify.clj
      
      Fixing a couple issues in existing drivers found by the validation
      Unverified
      61828f4e
  28. Nov 23, 2021
  29. Nov 04, 2021
    • Jeff Evans's avatar
      Change all active TEXT columns in MySQL app DB to LONGTEXT (#18749) · b4610877
      Jeff Evans authored
      
      * Change all active TEXT columns in MySQL app DB to LONGTEXT
      
      Add new text.type Liquibase property to dynamically select the correct text type to use, per DB (which is LONGTEXT for MySQL), very similar to the existing blob.type one
      
      Adding new migrations that update all existing app DB TEXT columns to LONGTEXT columns, only for mariadb/mysql
      
      Update migrations linter to ensure no new text types get added, via a new predicate that searches for text types being added
      
      Do the same logic for "blob" now (should be "${blob.type}"), update rule and test
      
      Add test for migrations, that checks the new types, for all types in scope for this PR, to ensure that they have all been changed to their expected DB-specific type (either LONGTEXT for MySQL or TEXT/CLOB for others)
      
      Updating a couple migrations to remove special casing that was originally done only for MySQL to simply make them universally "${text.type}", in order to unify behavior and reduce surprises going forward
      
      Co-authored-by: default avatarCam Saul <github@camsaul.com>
      Unverified
      b4610877
  30. Nov 03, 2021
    • Cam Saul's avatar
      Add index to ModerationReview moderated_item_type + moderated_item_id (#18799) · 7d614623
      Cam Saul authored
      * Revert changes from Jeff's PR
      
      * Add index to ModerationReview moderated_item_type + moderated_item_id
      
      * Add to 0.41.2 instead
      
      * Require explicit index name for createIndex
      
      * Move 41.2 migrations to after the 41.0 migrations
      
      * Adopt new migration numbering scheme
      
      * Fix comments
      
      * Fix MySQL + MariaDB insanity
      
      * Fix ID range validation
      
      * Actually 382 is the last legacy ID
      
      * Improved validation and tests
      
      * Adopt the new-new migration ID format.
      
      * Test fixes :wrench:
      Unverified
      7d614623
    • Cam Saul's avatar
      Adopt new migration numbering scheme (#18821) · 2fee04b7
      Cam Saul authored
      * Adopt new migration numbering scheme
      
      * Fix comments
      
      * Fix MySQL + MariaDB insanity
      
      * Fix ID range validation
      
      * Actually 382 is the last legacy ID
      
      * Improved validation and tests
      
      * Adopt the new-new migration ID format.
      
      * Test fixes :wrench:
      Unverified
      2fee04b7
  31. Oct 19, 2021
    • Dennis Schridde's avatar
      Fix precondition of change set 97 (#16095) · 2d88ae48
      Dennis Schridde authored
      * Fix precondition of change set 97
      
      Without the `type` and with the space Liquibase is unable to parse this
      precondition.
      
      During `lein test` it outputs:
      ```
      [clojure-agent-send-off-pool-0] DEBUG liquibase.changelog - Running Changeset:migrations/000_migrations.yaml::97::senior
      [clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Changeset migrations/000_migrations.yaml::97::senior
      [clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Added 0.32.0
      [clojure-agent-send-off-pool-0] INFO  liquibase.changelog - Marking ChangeSet: migrations/000_migrations.yaml::97::senior ran despite precondition failure due to onFail='MARK_RAN':
                liquibase.yaml : DBMS Precondition failed: expected null, got h2
      
      [clojure-agent-send-off-pool-0] DEBUG liquibase.changelog - Skipping ChangeSet: migrations/000_migrations.yaml::97::senior
      [clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Executing with the 'jdbc' executor
      [clojure-agent-send-off-pool-0] DEBUG liquibase.executor - 1 row(s) affected
      ```
      
      After this change the output changes to:
      ```
      [clojure-agent-send-off-pool-0] DEBUG liquibase.changelog - Running Changeset:migrations/000_migrations.yaml::97::senior
      [clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Changeset migrations/000_migrations.yaml::97::senior
      [clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Added 0.32.0
      [clojure-agent-send-off-pool-0] INFO  liquibase.changelog - Marking ChangeSet: migrations/000_migrations.yaml::97::senior ran despite precondition failure due to onFail='MARK_RAN':
                liquibase.yaml : DBMS Precondition failed: expected mysql,mariadb, got h2
      
      [clojure-agent-send-off-pool-0] DEBUG liquibase.changelog - Skipping ChangeSet: migrations/000_migrations.yaml::97::senior
      [clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Executing with the 'jdbc' executor
      [clojure-agent-send-off-pool-0] DEBUG liquibase.executor - 1 row(s) affected
      ```
      
      For documentation of the syntax cf.
       https://docs.liquibase.com/concepts/advanced/preconditions.html
      
      
      
      * Extend migration linter to check dbms preconditions
      
      * Also validate the `type` field of the `dbms` precondition
      
      Co-authored-by: default avatardpsutton <dan@dpsutton.com>
      Unverified
      2d88ae48
  32. Oct 04, 2021
    • Ariya Hidayat's avatar
      Rename NODE_ENV to WEBPACK_BUNDLE (#18087) · 3a67ddc1
      Ariya Hidayat authored
      NODE_ENV interferes with other tools (e.g. `yarn` won't pull
      devDependencies). Since what we need is only a flag indicating Webpack
      to bundle for production vs developement, invent our own env.
      
      This also solves the mystery of unable to call `yarn build` in the build
      script `bin/build-mb/src/build.clj`.
      Unverified
      3a67ddc1
  33. Sep 27, 2021
    • Pawit Pornkitprasan's avatar
      Fix {0} being shown when locale is "pt" (#17875) · 35651360
      Pawit Pornkitprasan authored
      This is a combination of 2 issues:
       1) pt got renamed to pt_BR in x.39.x but the old
          "pt" value may still be stored in the database
       2) when making a release, an unclean build
          directory may be used containing old "pt"
          resource which gets leaked into the release build
      
      1) is fixed by adding a function to treat "pt" as "pt_BR"
      to support users who were on "pt" since pre-x.39.
      (This is done by finding the closest fallback locale)
      
      2) is fixed by emptying the folder before generating locales
      so any old locales are deleted.
      
      Fixes #16690
      Unverified
      35651360
  34. Sep 14, 2021
    • pawit-metabase's avatar
      i18n: do not remove missing plural from translation (#17799) · b178e30e
      pawit-metabase authored
      The ttag library expect the plural array to be exactly the size as
      the number of plural forms defined in the header.
      
      If we remove empty plural, the array will have the wrong size and
      the library will crash when the trying to use the non-existent
      plural.
      
      By leaving the empty string there, the ttag library will correctly
      detect it and use the English version for the missing variant.
      
      This does not affect the backend because the backend does not
      support plurals.
      
      Fixes #16323
      Unverified
      b178e30e
Loading