Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Sep 16, 2024
    • Case Nelson's avatar
      fix: snowflake compile day trunc to timestamp_ltz (#47874) · 85857aeb
      Case Nelson authored
      Fixes #47426
      
      Date operations return values based on the timestamp offset rather than
      the session/db timezone. Converting to `timestamp_ltz` first ensures
      that we get predictable results.
      
      In the test, it is important that database timezone matches
      report_timezone so that post-processing gives proper results.
      Unverified
      85857aeb
  2. Sep 09, 2024
    • Case Nelson's avatar
      fix: bigquery add null checks to result processing (#47590) · 07dd373f
      Case Nelson authored
      * fix: bigquery add null checks to result processing
      
      Fixes #47339
      
      On the related issue there are different stacktraces indicating
      likely sources of null pointer exceptions.
      
      1. `.getNextPage` is likely returning a nil value. I was unable to reproduce this but one thing I did notice is that `hasNextPage` is recommended over checking `.getNextPageToken`. Added nil handling around `page` possibly being nil.
      
      2. `cancel-chan` may be triggered before processing begins and such `execute-bigquery` would pass nil as a TableResult to the initial reducer. Testing if cancel-chan happens at just the right moment would be too flaky for CI testing but I was able to reproduce this locally and is fixed by the nil handling added.
      
      3. `cancel-chan` may be triggered during query processing. This is covered by a test now.
      
      * Check hasNextPage in test:
      
      * Add test for null getNextPage
      
      * Fix cljfmt
      Unverified
      07dd373f
  3. Sep 04, 2024
  4. Aug 30, 2024
  5. Aug 29, 2024
  6. Aug 28, 2024
  7. Aug 27, 2024
  8. Aug 26, 2024
  9. Aug 23, 2024
  10. Aug 22, 2024
  11. Aug 21, 2024
  12. Aug 20, 2024
  13. Aug 14, 2024
  14. Aug 07, 2024
    • dpsutton's avatar
      Exclude javax.annotation/javax.annotation-api (#46546) · e5a3827e
      dpsutton authored
      dep is brought in by google cloud
      
      From `clj -X:deps tree :aliases '[:ee :drivers]'`
      
      ```
        . metabase/bigquery-cloud-sdk metabase/modules/drivers/bigquery-cloud-sdk
          . com.google.cloud/google-cloud-bigquery 2.38.1
            . com.google.cloud/google-cloud-core 2.35.0
            [...]
            . javax.annotation/javax.annotation-api 1.3.2
      ```
      
      Before this change:
      
      ```
      ❯ clj -X:deps tree :aliases '[:ee :drivers]' | grep 'javax.annotation/javax.annotation-api'
            . javax.annotation/javax.annotation-api 1.3.2
      ```
      
      After:
      
      ```
      ❯ clj -X:deps tree :aliases '[:ee :drivers]' > deps-master
      
      ❯ echo $?
      0
      ```
      Unverified
      e5a3827e
  15. Aug 05, 2024
  16. Aug 01, 2024
    • lbrdnk's avatar
      Avoid adding temporal-unit to lhs cols (#46262) · 07648603
      lbrdnk authored
      * Avoid adding temporal-unit to lhs cols
      
      * Use :default temporal-unit
      
      * Simplify logic, update comments
      
      * Update substitute-field-filter-test
      
      * Update align-temporal-unit-with-param-type-test
      
      * Update field-filter-date-test
      
      * Use end-excludding gte lt filter for DateTime fields
      
      * Update substitute-field-filter-test
      
      * Update align-temporal-unit-with-param-type-test
      
      * Update field-filter-date-test
      
      * Update bigquery test + comment
      
      * Update date-str->qp-aware-offset-dt
      
      * Add guard for unexpected date string format
      
      This is just for the completeness, I haven't encountered it.
      
      * Address review remarks
      
      * Update comment
      Unverified
      07648603
  17. Jul 31, 2024
  18. Jul 25, 2024
  19. Jul 23, 2024
  20. Jul 19, 2024
    • lbrdnk's avatar
      Add basic auth params to `dbms-version` call on Druid (#45729) · a5eb647e
      lbrdnk authored
      * Add basic auth to dbms-version
      
      * Add test
      Unverified
      a5eb647e
    • lbrdnk's avatar
      Remove `:foreign-keys` feature or convert to `:metadata/key-constraints` where appropriate (#44894) · 9c708c21
      lbrdnk authored
      
      * Post sync hook stub for implicit joins testing stub
      
      * Add join alias to field lvalues to enable sorting on joined fields
      
      * Disable :foreign-keys on Mongo
      
      * Require :left-join support for implicit joins instead of :foreign-keys
      
      * Update implicit joins tests
      
      * Adjust sync-fields-test
      
      * Update implicit joins feature check test
      
      * Transform post-sync-hook to normal function
      
      * Add foreign key relationships only for dbmses without :foreign-keys feature
      
      * Update test to handle Oracle correctly
      
      * Split convoluted fn
      
      * Avoid unnecessary computations for datasets with no fks
      
      * Update docstring
      
      * Fix driver usage
      
      * Transform :foreign-keys to :metadata/key-constraints in test data loading code
      
      * Update sync_test.clj
      
      * Update driver_test.clj
      
      * Update moviedb.clj
      
      * Update dataset_definition_test.clj
      
      * Update fetch_metadata.clj
      
      * Update fields_test.clj
      
      * Update driver.clj
      
      * Update driver/sql.clj
      
      * Set sql driver join support to true for all joins
      
      Deriving drivers are expected to set to false where applicable.
      
      * Update sqllite.clj
      
      * Remove foreign-keys from spark
      
      * Remove :foreign-keys from presto
      
      * Remove :foreign-keys from Athena
      
      * Remove foreign-keys from big query
      
      Reading docs it seems fk inference should be ok. Let's see the test results. Act based on that.
      
      * Update test_metadata.cljc
      
      * Set key-constraints to false for bigquery
      
      * Add foreign keys to sqlite manually until sync is fixed
      
      * Return driver require to Athena
      
      * Correct typo
      
      * Add naive primary key heuristic
      
      * Update pk fk logic to handle name components correctly
      
      * Add alias escaping to presto
      
      * Add ordering to test
      
      * Add order by to test
      
      * Update test
      
      * Remove use of rewrite-fields-to-force-using-column-aliases in order by fields
      
      * Add exception to alias forcing
      
      * Different approach to exception from alias forcing
      
      * Alternative approach for prefixing idents in bigq
      
      * All seelcted fields by desired alias
      
      * Rewrite only fields not from this source table
      
      * Update test
      
      * Enable breakout-on-fk-field-test for :left-join drivers
      
      * Add feature comment
      
      * Explicit joins tests foreign-keys removal
      
      * Update nested_queries_test.clj
      
      * Update remapping tests
      
      * Update tests
      
      * Update tests to handle sqlite results format
      
      * Disable metadata/key-constraints on sqlite during tests until
      
      * Address remarks
      
      * Remove mt/with-mock-fks-for-drivers-without-fk-constraints
      
      * Update bigquery test
      
      * Update tests
      
      * Adjust row level restrictions
      
      * Add parameterized-sql feature
      
      * Update comment
      
      * Update leftovers
      
      * Order keys
      
      * Remove foreign keys from frontend
      
      * Fix FE unit
      
      * Update driver changelog
      
      * Address review remark
      
      * Update test/metabase/query_processor/test_util.clj
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Update docs/developers-guide/driver-changelog.md
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Update docs/developers-guide/driver-changelog.md
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Update modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk/query_processor.clj
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Update docs/developers-guide/driver-changelog.md
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Update test
      
      * Update comment and reduce expression
      
      * Update comment
      
      * Address remarks
      
      * Fix merge
      
      ---------
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      Unverified
      9c708c21
  21. Jul 18, 2024
    • Case Nelson's avatar
      test: add database feature to test identifiers with spaces (#45680) · bcd5a002
      Case Nelson authored
      * tests for drivers with spaces in their identifiers
      
      * Add driver feature
      
      * Fix tests
      
      * Remove ambiguous alias for sqlite
      
      * Try to fix bigquery and sqlite tests not seeing left-join support
      
      * Add explicit support for left-join because of foreign-keys during test hacks
      
      * Handle left-join support weirdness
      
      * Fix test
      Unverified
      bcd5a002
    • Cam Saul's avatar
      Use single connection for test data loading & big test data loading improvements (#45268) · bab905c0
      Cam Saul authored
      * Reuse connection for test data loading & JDBC data loading overhaul
      
      * Revert silly change
      
      * Remove unneeded logic for recording which datasets are loaded or not-yet-loaded
      
      * Ok so I guess we do need the code to detect duplicate dataset loading after all
      
      * B I G  improvements
      
      * Appease Kondo
      
      * Test fixes :wrench:
      
      * More test fixes :wrench:
      
      * Fix dataset-already-loaded?-test
      
      * Fix test
      
      * Fix Presto JDBC and greatly improve test data load speed for it
      
      * Postgres test fix :wrench:
      
      * Fix compilation errors
      
      * MySQL fixes :wrench:
      
      * Fix syntax error
      
      * MySQL fixes :wrench:
      
      * Implement `dataset-already-loaded?` for Athena and cache the set of existing databases
      
      * Fix Redshift
      
      * Fix Presto JDBC
      
      * Vertica test fix :wrench:
      
      * Fix Oracle dataset-already-loaded?
      
      * Test fixes and parallelize some API tests.
      
      * Test fixes :wrench:
      
      * Oracle test fix? :wrench:
      
      * Another test fix :wrench:
      
      * Stop putting random spaces in code bodies this is not JavaScript code
      
      * with-temp-vals-in-db should merge in original value of Database settings
      
      * The most test fixes :wrench:
      
      * 3 or 4 test fixes :wrench:
      
      * Add schemas around stuff to catch errors
      
      * Appease Kondo
      
      * Implement dataset-already-loaded? for vertica
      
      * Implement dataset-already-loaded? for SQLite and Snowflake
      Unverified
      bab905c0
  22. Jul 17, 2024
  23. Jul 16, 2024
  24. Jul 12, 2024
    • Braden Shepherdson's avatar
      [perf] Fix remaining thread leak in BigQuery query execution (#45253) · 52d77200
      Braden Shepherdson authored
      This comes in two parts.
      
      **Rebuilt query logic**
      
      I rewrote the query exec logic to use one `future` and one `a/go` block,
      reporting results to a `promise`. This is easier to follow and doesn't leak
      threads like the original implementation with two `future`s.
      
      The single future is guaranteed to exit. It blocks on the BigQuery call.
      That will either complete or throw an exception. Either the exception or
      the BigQuery result is sent to the promise, and then the future is
      complete. The only reference to that future is overwritten after the `promise`
      resolves, so the `future`, its closure, and its thread don't persist longer than needed.
      
      **Return a reducible result**
      
      Previously the results were returned as a lazy sequence, but that brings
      a lot of `seq` overhead, and is a risk of retaining the entire result
      set in memory until the query is all done. Above all, it doesn't support
      `reduced?` to explicitly drop any further results.
      
      The `thunk` function style of `qp.reducible/reducible-rows` doesn't fit
      neatly here, so I implemented the reducible logic directly on top of the
      `Iterable` BigQuery results.
      
      **Verifying**
      
      This is a bit tricky. I've been testing it like this:
      
      - Add a BigQuery database to my instance
      - Create a saved question and note its ID (say, 123)
      - Create an API key in (EE) Metabase and save it in an env var
      - Install the `siege` load testing tool
      - Install VisualVM and monitor my Clojure REPL process's thread count
      - `siege --concurrent=15 --time=30s --header="x-api-key: $API_KEY" "http://localhost:3000/api/card/123/query POST"`
      
      That will create a bunch of new threads while it's getting called, but
      within a minute of the last queries they'll gradually drop out of the
      thread pools and it will return to the baseline number of threads.
  25. Jul 11, 2024
  26. Jul 08, 2024
  27. Jul 03, 2024
  28. Jul 02, 2024
Loading