Skip to content
Snippets Groups Projects
Unverified Commit 71520bcc authored by Jeff Bruemmer's avatar Jeff Bruemmer Committed by GitHub
Browse files

prettier formatting (#49551)

parent 632e1386
No related branches found
No related tags found
No related merge requests found
Showing
with 149 additions and 140 deletions
frontend/src/cljs
docs/configuring-metabase/environment-variables.md
docs/api/*
docs/api-documentation.md
......@@ -22,4 +22,4 @@ Write SQL to create new actions.
## [Actions on dashboards](../dashboards/actions.md)
Add actions on dashboards as buttons that you can pass filter values to.
\ No newline at end of file
Add actions on dashboards as buttons that you can pass filter values to.
......@@ -75,11 +75,11 @@ If you select "Don't cache results" for a question, dashboard, or database, Meta
You can set caching policies for different entities.
- [Setting a default caching policy](#default-caching-policy)
- [Database caching policy (specific to each connected database)](#database-caching-policy)*
- [Dashboard caching](#dashboard-caching-policy)*
- [Question caching](#question-caching-policy)*
- [Database caching policy (specific to each connected database)](#database-caching-policy)\*
- [Dashboard caching](#dashboard-caching-policy)\*
- [Question caching](#question-caching-policy)\*
_* Denotes [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) features._
_\* Denotes [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) features._
### Default caching policy
......
......@@ -73,14 +73,15 @@ Report timezone doesn't apply to `timestamp without time zone` data types, inclu
| `2022-12-28T12:00:00` | `timestamp without time zone` | 'Canada/Eastern' | Dec 28, 2022, 12:00 AM |
Report timezone is only supported for the following databases:
- BigQuery
- Druid
- MySQL
- Oracle
- PostgreSQL
- Presto
- Redshift
- Vertica
- BigQuery
- Druid
- MySQL
- Oracle
- PostgreSQL
- Presto
- Redshift
- Vertica
## First day of the week
......
......@@ -13,4 +13,4 @@ If you're upgrading from Metabase 50 or earlier, all of your existing metrics wi
- Anyone can create a new metric.
- Metrics can be stored (and pinned) to collections.
- If you have curate access to the collection, you can edit a metric in that collection.
- You can explore metrics in your Metabase in the data browser.
\ No newline at end of file
- You can explore metrics in your Metabase in the data browser.
......@@ -81,4 +81,4 @@ When you click on a metric, Metabase will assume that you're using that metric a
## Further reading
- [Models](./models.md)
- [Segments](./segments.md)
\ No newline at end of file
- [Segments](./segments.md)
......@@ -113,7 +113,6 @@ This policy provides read-only permissions for data in S3. You'll need to specif
There may be additional permissions required for other Athena functionality, like federated queries. For details, check out the [Athena docs](https://docs.aws.amazon.com/athena/latest/ug/security-iam-athena).
```json
{
"Version": "2012-10-17",
......@@ -209,7 +208,7 @@ If Metabase also needs to create tables, you'll need additional AWS Glue permiss
"glue:CreatePartition",
"glue:DeletePartition",
"glue:UpdatePartition",
"glue:GetCatalogImportStatus",
"glue:GetCatalogImportStatus"
],
"Resource": "*"
}
......@@ -217,7 +216,6 @@ If Metabase also needs to create tables, you'll need additional AWS Glue permiss
}
```
## Further reading
- [Managing databases](../../databases/connecting.md)
......
......@@ -23,10 +23,9 @@ title: API changelog
- `/api/legacy-metric`
The `/api/legacy-metric` endpoints have been removed.
The `/api/legacy-metric` endpoints have been removed.
- `POST /api/session/pulse/unsubscribe` and `POST /api/session/pulse/unsubscribe/undo` have been moved to `POST
/api/pulse/unsubscribe` and `POST /api/pulse/unsubscribe/undo` respectively.
- `POST /api/session/pulse/unsubscribe` and `POST /api/session/pulse/unsubscribe/undo` have been moved to `POST /api/pulse/unsubscribe` and `POST /api/pulse/unsubscribe/undo` respectively.
## Metabase 0.50.0
......@@ -46,15 +45,15 @@ title: API changelog
- `/api/metric`
The `/api/metric` endpoints has been renamed to `/api/legacy-metric` to reflect that fact it will not be used for the new version of metrics. The new version uses the `/api/card` endpoints.
The `/api/metric` endpoints has been renamed to `/api/legacy-metric` to reflect that fact it will not be used for the new version of metrics. The new version uses the `/api/card` endpoints.
- `GET /api/permissions/graph` and `PUT /api/permissions/graph`
The `data` key has been removed from the permissions graph. The `data` key has been replaced with two new keys: `view-data` and `create-queries`.
Valid permission values for `view-data` are `unrestricted`, `blocked`, `sandboxed` or `restricted`. Valid permission values
for `create-queries` are `query-builder-and-native`, `query-builder`, and `no`.
The `data` key has been removed from the permissions graph. The `data` key has been replaced with two new keys: `view-data` and `create-queries`.
Valid permission values for `view-data` are `unrestricted`, `blocked`, `sandboxed` or `restricted`. Valid permission values
for `create-queries` are `query-builder-and-native`, `query-builder`, and `no`.
If you're scripting permissions, you'll need to update your scripts to reflect these breaking changes to the `/api/permissions/graph` endpoints. For more about the new data permissions of View data and Create queries, see our docs on [data permissions](../permissions/data.md). And here's a page that [talks about the change (and why we did it)](../permissions/no-self-service-deprecation.md).
If you're scripting permissions, you'll need to update your scripts to reflect these breaking changes to the `/api/permissions/graph` endpoints. For more about the new data permissions of View data and Create queries, see our docs on [data permissions](../permissions/data.md). And here's a page that [talks about the change (and why we did it)](../permissions/no-self-service-deprecation.md).
- `GET /api/transform/:db-id/:schema/:transform-name`, which hasn't been used internally by Metabase for ages, has
been removed.
......@@ -62,6 +61,7 @@ title: API changelog
- `POST /api/user/:id/send_invite` is deprecated and will be removed in the next version.
## Metabase 0.49.5
NOTE: These endpoint changes were added in 0.49.3, and a bug in `GET /api/embed/card/:token/query/:export-format` was fixed in 0.49.5.
- `POST /api/card/:card-id/query/:export-format`
......@@ -70,17 +70,18 @@ NOTE: These endpoint changes were added in 0.49.3, and a bug in `GET /api/embed/
- `GET /api/embed/card/:token/query/:export-format`
- `GET /api/embed/dashboard/:token/dashcard/:dashcard-id/card/:card-id/:export-format`
The above endpoints now accept the `format_rows` query parameter. It is an optional boolean parameter that will default to `true` if not included in the request.
When `format_rows` is `true`, the export will have formatting applied such that the values match what they appear as in the app.
When `format_rows` is `false`, formatting is not applied and exports will behave as they did prior to 0.49.0.
The above endpoints now accept the `format_rows` query parameter. It is an optional boolean parameter that will default to `true` if not included in the request.
When `format_rows` is `true`, the export will have formatting applied such that the values match what they appear as in the app.
When `format_rows` is `false`, formatting is not applied and exports will behave as they did prior to 0.49.0.
The value of `format_rows` has no effect when exporting xlsx files.
The value of `format_rows` has no effect when exporting xlsx files.
## Metabase 0.49.0
- `POST /api/card` and `PUT /api/card/:id`
The `dataset` key is deprecated and will be removed in a future version, most likely 50. In its place we have added a new key: `type` which is equivalent in that it distinguishes Models from Questions. `type="model"` is equivalent to `dataset=true` and `type="question"` is equivalent to `dataset=false`.
The `dataset` key is deprecated and will be removed in a future version, most likely 50. In its place we have added a new key: `type` which is equivalent in that it distinguishes Models from Questions. `type="model"` is equivalent to `dataset=true` and `type="question"` is equivalent to `dataset=false`.
- all endpoints that return data (e.g. exports in JSON, XLSX, CSV, endpoints that end in "/query")
Starting from v49, we respond to the API calls with values formatted according to the instance localization options
Starting from v49, we respond to the API calls with values formatted according to the instance localization options
......@@ -76,8 +76,7 @@ Once you've installed all the build tools, you'll need to clone the [Metabase re
cd ~/workspace
```
{:start="3"}
3. Run the following command to “clone” Metabase into this folder, using the URL of the Metabase repository on GitHub:
{:start="3"} 3. Run the following command to “clone” Metabase into this folder, using the URL of the Metabase repository on GitHub:
```
git clone https://github.com/metabase/metabase
......@@ -89,8 +88,7 @@ This is the part that you’ll use over and over.
The “official” branch of Metabase is called `master`, and other feature development branches get merged into it when they’re approved. So if you want to try out a feature before then, you’ll need to know the name of that branch so you can switch over to it. Here’s what to do:
{:start="4"}
4. Open up your terminal app
{:start="4"} 4. Open up your terminal app
5. Navigate to where you're storing the Metabase code. If you followed this guide exactly, you'd get there by entering this command:
......@@ -107,7 +105,7 @@ The “official” branch of Metabase is called `master`, and other feature deve
You should do this every time to make sure that you have all the latest Metabase branches and code on your computer. It’s also how you’ll get updates on a feature branch someone make changes to it.
7. Find the name of the branch you want to run by going to the “pull request” page for that feature on GitHub and copying the branch name from there. Here’s [an example PR page](https://github.com/metabase/metabase/pull/19138), with the branch name
`fix-native-dataset-drill-popover`.
`fix-native-dataset-drill-popover`.
8. Switch to, or “check out,” that branch by running:
......@@ -129,27 +127,25 @@ The “official” branch of Metabase is called `master`, and other feature deve
## Run Metabase
{:start="9"}
9. Now we’ll start up the backend server of Metabase with:
{:start="9"} 9. Now we’ll start up the backend server of Metabase with:
```
clojure -M:run
```
```
clojure -M:run
```
When it’s done, you should see a message that says something like “Metabase initialization complete.” Keep this tab in your terminal app running, otherwise it’ll stop Metabase.
When it’s done, you should see a message that says something like “Metabase initialization complete.” Keep this tab in your terminal app running, otherwise it’ll stop Metabase.
10. Open up another tab or window of your terminal app, and then “build” the frontend (all the UI) with this command:
```
yarn build-hot
```
```
yarn build-hot
```
If you're having trouble with this step, make sure you are using the LTS version of [Node.js (http://nodejs.org/)](http://nodejs.org/).
{:start="11"}
11. In your web browser of choice, navigate to `http://localhost:3000`, where you should see Metabase!
{:start="11"} 11. In your web browser of choice, navigate to `http://localhost:3000`, where you should see Metabase!
This is the local “server” on your computer, and 3000 is the “port” that Metabase is running on. You can have multiple different apps running on different ports on your own computer. Note that if you share any URLs with others that begin with `localhost`, they won’t be able to access them because your computer by default isn’t open up to the whole world, for security.
This is the local “server” on your computer, and 3000 is the “port” that Metabase is running on. You can have multiple different apps running on different ports on your own computer. Note that if you share any URLs with others that begin with `localhost`, they won’t be able to access them because your computer by default isn’t open up to the whole world, for security.
To switch to a different branch or back to `master`, open up another Terminal tab, and repeat steps 6, 7, and 8. If Metabase wasn’t already running, you'll need to complete steps 9 and 10 again too. If it was already running, the frontend will automatically rebuild itself. You can check its progress by switching to that tab in your Terminal — it usually takes something like 15 seconds, but will depend on your hardware.
......@@ -165,10 +161,12 @@ The entire Metabase application is compiled and assembled into a single .jar fil
After running the build script simply look in `target/uberjar` for the output .jar file and you are ready to go.
### Build a Metabase Uberjar in a containerized environment
### Build a Metabase Uberjar in a containerized environment
If you want to build Metabase without installing Clojure, Java, and Node.js on your host machine, you can build the Uberjar inside a container by running:
```
DOCKER_BUILDKIT=1 docker build --output container-output/ .
```
Make sure that your Docker Daemon is running before executing the command. After running the command, you'll find the Metabase JAR file at `./container-output/app/metabase.jar`.
......@@ -4,6 +4,6 @@ title: Working with Clojure
# Working with Clojure
Check out [Clojure for the Brave and True](https://www.braveclojure.com/clojure-for-the-brave-and-true/). It's free online.
Check out [Clojure for the Brave and True](https://www.braveclojure.com/clojure-for-the-brave-and-true/). It's free online.
If you don't feel like reading a whole book, [Mark Volkmann's Clojure tutorial](https://mvolkmann.github.io/clojure/article.html) is another good starting point.
......@@ -10,12 +10,11 @@ The overall goal of a code review is to serve as a safety net for other people o
## Goals
* Catch bugs
* Catch non-obvious consequences of an approach - will this PR make future code harder to secure or more buggy.
* For situations where things were coded without being discussed, a code review serves as a sanity check to make sure a correct approach is being taken
* Point out implications of the PR for parts of Metabase that a PR doesn’t touch
* Point out places where a good approach or style was used. Code reviews are not a hatefest. Unless a PR is completely horrific there should be an equal number of good and bad points brought up.
- Catch bugs
- Catch non-obvious consequences of an approach - will this PR make future code harder to secure or more buggy.
- For situations where things were coded without being discussed, a code review serves as a sanity check to make sure a correct approach is being taken
- Point out implications of the PR for parts of Metabase that a PR doesn’t touch
- Point out places where a good approach or style was used. Code reviews are not a hatefest. Unless a PR is completely horrific there should be an equal number of good and bad points brought up.
## Mindset giving a code review
......@@ -35,29 +34,28 @@ When a reviewer disagrees with an approach you took, seek to understand why. The
If someone slaps a strong :-1: on your PR, be especially patient. Dig into why they think the PR is flawed. Approach the conversation with an intent of making the PR better, not defending your approach. You get no points for being a better debater, but you do get points for shipping better code and a better product, no matter where the inspiration or ideas came from.
## Process
* Every PR of significant complexity needs to be :+1:’d by at least one other engineer on the team (or @salsakran) to merge
* Add people you think should review your PR to the PR’s assignees. The reviewer can remove themselves once they have reviewed it, or decided they aren’t an appropriate reviewer
* Code that impacts other engineer’s work should be reviewed by those engineers
* A :+1: is the default “I’m ok with this"
* A :+0: (I made that up) is “I’m not thrilled with this, but other people saying “+1” means it can be merged
* A :-1: is a hard veto. This should be used sparingly in run of the mill PRs, and only for things that are missing tests, flagrant violations of a style guide, or break assumptions another part of the code base depends on.
* If you cut a major branch without discussing design, or talking through implications with other engineers whose work might be impacted, you should expect a :-1:, and not be hung up on reworking controversial sections.
* Any PR that has a :-1: CANNOT be merged until it is resolved.
* The owner of the PR and the person casting a :-1: should resolve the differences in approach.
* If there's an impasse, @salsakran casts a tie-breaking vote. Impasses should be rare.
- Every PR of significant complexity needs to be :+1:’d by at least one other engineer on the team (or @salsakran) to merge
- Add people you think should review your PR to the PR’s assignees. The reviewer can remove themselves once they have reviewed it, or decided they aren’t an appropriate reviewer
- Code that impacts other engineer’s work should be reviewed by those engineers
- A :+1: is the default “I’m ok with this"
- A :+0: (I made that up) is “I’m not thrilled with this, but other people saying “+1” means it can be merged
- A :-1: is a hard veto. This should be used sparingly in run of the mill PRs, and only for things that are missing tests, flagrant violations of a style guide, or break assumptions another part of the code base depends on.
- If you cut a major branch without discussing design, or talking through implications with other engineers whose work might be impacted, you should expect a :-1:, and not be hung up on reworking controversial sections.
- Any PR that has a :-1: CANNOT be merged until it is resolved.
- The owner of the PR and the person casting a :-1: should resolve the differences in approach.
- If there's an impasse, @salsakran casts a tie-breaking vote. Impasses should be rare.
Note that these :+1:, :+0:, and :-1:’s should be explicitly stated in a comment, and not a reaction on the main description of the PR on github. A change from :-1: to :+1: should also be stated explicitly on a comment.
## Timing
* PRs for high priority issues should be code reviewed as soon as they are available.
* PRs for issues in a milestone can wait a few days.
* If there are no :+1:'s on a PR, it is the responsibility of the PR creator to follow up with others and get their code reviewed. To re-iterate, a PR needs to be :+1:’d to be merged, and if it has not been reviewed, it is on the opener of the PR to round up a reviewer.
* If there's a :-1: + no clear resolution, both the creator of the PR and the :-1: voter should plan on spending an hour over the next day or two to discuss the issue, and plan on how to resolve it.
* In the event of no movement on a PR with a :-1: after a week, @salsakran will chime in.
- PRs for high priority issues should be code reviewed as soon as they are available.
- PRs for issues in a milestone can wait a few days.
- If there are no :+1:'s on a PR, it is the responsibility of the PR creator to follow up with others and get their code reviewed. To re-iterate, a PR needs to be :+1:’d to be merged, and if it has not been reviewed, it is on the opener of the PR to round up a reviewer.
- If there's a :-1: + no clear resolution, both the creator of the PR and the :-1: voter should plan on spending an hour over the next day or two to discuss the issue, and plan on how to resolve it.
- In the event of no movement on a PR with a :-1: after a week, @salsakran will chime in.
## How to improve the quality of the code review
......@@ -65,8 +63,8 @@ For a summary of research on code reviews, check out [How code review works (and
### What PR authors can do to get a better review
- Guide reviewers by commenting on the important sections of the code.
- If you need someone's expertise/opinion, tag that person.
- Guide reviewers by commenting on the important sections of the code.
- If you need someone's expertise/opinion, tag that person.
- Enhance PR descriptions by using [Notes and Warnings](https://github.com/github-community/community/discussions/16925) - these can be effective tools if you want a certain piece of information to stand out.
### What PR reviewers can do to give a better review
......
......@@ -37,7 +37,7 @@ The core team runs a pretty well defined product process. It is actively being t
### A) Identify product needs from the community
We actively look for new feature ideas from our community, user base and our own use of Metabase internally. We concentrate on the underlying *problem* or *need* as opposed to requests for specific features. While sometimes suggested features are built as requested, often we find that they involve changes to existing features, and perhaps an entirely different solution to the underlying problem. These will typically be collected in a number of issues, and tagged [Proposal](https://github.com/metabase/metabase/labels/.Proposal)
We actively look for new feature ideas from our community, user base and our own use of Metabase internally. We concentrate on the underlying _problem_ or _need_ as opposed to requests for specific features. While sometimes suggested features are built as requested, often we find that they involve changes to existing features, and perhaps an entirely different solution to the underlying problem. These will typically be collected in a number of issues, and tagged [Proposal](https://github.com/metabase/metabase/labels/.Proposal)
### B) Synthesize these needs into a concrete feature
......
......@@ -6,7 +6,7 @@ title: How to run a development branch of Metabase using Docker
If you want to run a branch of Metabase that's currently in development, the easiest way to get started is to use a pre-built Docker image. You can also [compile Metabase yourself](build.md).
If you're looking to download and run the latest official open source version of Metabase, check the [operations guide](../installation-and-operation/installing-metabase.md).
If you're looking to download and run the latest official open source version of Metabase, check the [operations guide](../installation-and-operation/installing-metabase.md).
## Installing Docker
......@@ -21,6 +21,7 @@ OR
```bash
brew install --cask docker
```
Once Docker is installed, you’re ready to go.
## Run a development branch to test or verify features
......@@ -29,7 +30,7 @@ Once Docker is installed, you’re ready to go.
1. Open your terminal app of choice.
2. Copy and paste this command, switching out `<branch-name>` for the name of the branch you’d like to test:
2. Copy and paste this command, switching out `<branch-name>` for the name of the branch you’d like to test:
```bash
docker run --platform linux/amd64 -d -p 3000:3000 --name metabase-dev metabase/metabase-dev:<branch-name>
......
......@@ -19,7 +19,7 @@ To spin up a development environment, run:
yarn dev
```
This runs both the [frontend](#frontend) and [backend](#backend). Alternatively, you can run them separately in two terminal sessions below.
This runs both the [frontend](#frontend) and [backend](#backend). Alternatively, you can run them separately in two terminal sessions below.
### Frontend
......@@ -40,7 +40,6 @@ See [Frontend development](#frontend-development).
### Backend
Run your backend development server with
```
......@@ -192,7 +191,7 @@ This approach requires creating a `.lein-env` file within your project directory
:mb-db-pass ""}
```
Despite the name, this file works fine with `deps.edn` projects. An advantage of this approach versus the global `deps.edn` approach is that it is scoped to this project only.
Despite the name, this file works fine with `deps.edn` projects. An advantage of this approach versus the global `deps.edn` approach is that it is scoped to this project only.
Only use this for development, it is not supported for production use. There is already entry in `.gitignore` to prevent you accidentally committing this file.
......@@ -351,6 +350,7 @@ Here's the one for postgres in `metabase.test.data.postgres`:
```
You can see that this looks in the environment for:
- host (defaults to "localhost")
- port (defaults to 5432)
- user
......@@ -374,7 +374,6 @@ some-ns=> (take 10 (keys environ.core/env))
:sun-management-compiler)
```
### Running the linters
`clj-kondo` must be [installed separately](https://github.com/clj-kondo/clj-kondo/blob/master/doc/install.md).
......
......@@ -56,8 +56,7 @@ title: Driver interface changelog
- The `:skip-drop-db?` option sometimes passed to methods for loading and destroying test data is no longer passed,
you can remove code that checks for it. Test data code is now better about avoiding unneeded/redundant calls to
`metabase.test.data.interface/create-db!`, so test data loading code should not need to call `DROP DATABASE IF
EXISTS` before loading test data.
`metabase.test.data.interface/create-db!`, so test data loading code should not need to call `DROP DATABASE IF EXISTS` before loading test data.
- Test data loading for JDBC-based databases has been overhauled somewhat. The multimethod
`metabase.test.data.sql-jdbc.load-data/load-data!` and helper functions for it have been removed in favor of several
......@@ -90,7 +89,7 @@ title: Driver interface changelog
- Similarly, `metabase.test.data.sql-jdbc.execute/execute-sql!` and helper functions like
`metabase.test.data.sql-jdbc.execute/sequentially-execute-sql!` are now called with a `java.sql.Connection`
instead of both a `DatabaseDefinition` and either `:server` or `:db` *context*; the appropriate connection type is
instead of both a `DatabaseDefinition` and either `:server` or `:db` _context_; the appropriate connection type is
created automatically and passed in in the calling code. Update your method implementations and usages
accordingly.
......@@ -110,8 +109,8 @@ title: Driver interface changelog
drivers by default. Previously, those depended on the `:foreign-keys` feature. If your driver supports `:left-join`,
the test for remapping and implicit joins will be now executed.
- The`:parameterized-sql` driver feature has been added to distinguish drivers that don't support parametrized SQL in
tests. Currently, this is disabled only for `:sparksql`.
- The`:parameterized-sql` driver feature has been added to distinguish drivers that don't support parametrized SQL in
tests. Currently, this is disabled only for `:sparksql`.
- The test methods `metabase.test.data.interface/supports-time-type?` and
`metabase.test.data.interface/supports-timestamptz-type?` have been removed and replaced by the features
......@@ -121,7 +120,7 @@ title: Driver interface changelog
- Drivers that use `metabase.driver.sql.query-processor/->honeysql` can implement
`:metabase.driver.sql.query-processor/nfc-path` to include the nfc-path in the field identifier. So that record-like
fields can be referenced with `<table>.<record>.<record-field>`. See `bigquery-cloud-sdk` for an example. Defaults to `nil` to indicate that the path should not be part of the identifier.
fields can be referenced with `<table>.<record>.<record-field>`. See `bigquery-cloud-sdk` for an example. Defaults to `nil` to indicate that the path should not be part of the identifier.
- `:test/dynamic-dataset-loading` feature has been added. It enables drivers to bail out of tests that require
creation of new, not pre-loaded, dataset during test run time.
......@@ -134,7 +133,7 @@ title: Driver interface changelog
## Metabase 0.50.17
- Added method `metabase.driver/incorporate-auth-provider-details` for driver specific behavior required to
incorporate response of an auth-provider into the DB details. In most cases this means setting the :password
incorporate response of an auth-provider into the DB details. In most cases this means setting the :password
and/or :username based on the auth-provider and its response.
## Metabase 0.50.16
......@@ -212,11 +211,11 @@ title: Driver interface changelog
- New feature `:metadata/key-constraints` has been added to signify that a driver support defining and enforcing foreign
key constraints at the schema level. This is a different, stronger condition than `:foreign-keys`. Some databases
(Presto, Athena, etc.) support *querying* over foreign key relationships (`:foreign-keys`) but do not track or enforce
(Presto, Athena, etc.) support _querying_ over foreign key relationships (`:foreign-keys`) but do not track or enforce
those relationships in the schema. Defaults to `true` in `:sql` and `:sql-jdbc` drivers; set to `false` in the
first-party SparkSQL, Presto and Athena drivers.
- New feature `:connection/multiple-databases` has been added to indicate whether a *connection* to this driver
- New feature `:connection/multiple-databases` has been added to indicate whether a _connection_ to this driver
corresponds to multiple databases or just one. The default is `false`, where a connection specifies a single database.
This is the common case for classic relational DBs like Postgres, and some cloud databases. In contrast, a driver like
Athena sets this to `true` because it connects to an S3 bucket and treats each file within it as a database.
......@@ -300,6 +299,7 @@ title: Driver interface changelog
which has access to `value` and therefore provides more flexibility for choosing the right conversion unit.
## Metabase 0.48.0
- The MBQL schema in `metabase.mbql.schema` now uses [Malli](https://github.com/metosin/malli) instead of
[Schema](https://github.com/plumatic/schema). If you were using this namespace in combination with Schema, you'll
want to update your code to use Malli instead.
......@@ -313,9 +313,9 @@ title: Driver interface changelog
- The following functions in `metabase.query-processor.store` (`qp.store`) are now deprecated
* `qp.store/database`
* `qp.store/table`
* `qp.store/field`
- `qp.store/database`
- `qp.store/table`
- `qp.store/field`
Update usages of the to the corresponding functions in `metabase.lib.metadata` (`lib.metadata`):
......@@ -347,7 +347,7 @@ title: Driver interface changelog
new function takes a Field as returned by `lib.metadata/field`, i.e. a `kebab-case` map.
- Tests should try to avoid using any of the `with-temp` helpers or application database objects; instead, use the
metadata functions above and and the helper *metadata providers* in `metabase.lib`, `metabase.lib.test-util`, and
metadata functions above and and the helper _metadata providers_ in `metabase.lib`, `metabase.lib.test-util`, and
`metabase.query-processor.test-util` for mocking them, such as `mock-metadata-provider`,
`metabase-provider-with-cards-for-queries`, `remap-metadata-provider`, and `merged-mock-metadata-provider`.
......@@ -579,7 +579,7 @@ to note when porting your driver:
`:inline` to force the SQL to be generated inline instead: `{:select [[[:inline 1]]]}` becomes `SELECT 1`. Numbers
generated by the SQL query processor code should automatically be inlined, but you may need to make sure any
numbers you generate are wrapped in `:inline` if they can end up as expressions inside a `GROUP BY` clause. Some
databases can recognize expressions as being the same thing only when they are *not* parameterized:
databases can recognize expressions as being the same thing only when they are _not_ parameterized:
```sql
-- This is okay
......@@ -593,8 +593,8 @@ to note when porting your driver:
GROUP BY x + ?
```
Exercise caution when `:inline`ing things -- take care not to use it on untrusted strings or other avenues for SQL
injection. Only inlining things that are a `number?` is a safe bet.
Exercise caution when `:inline`ing things -- take care not to use it on untrusted strings or other avenues for SQL
injection. Only inlining things that are a `number?` is a safe bet.
Please read [Differences between Honey SQL 1.x and
2.x](https://github.com/seancorfield/honeysql/blob/develop/doc/differences-from-1-x.md) for more information on the
......@@ -635,8 +635,7 @@ Similarly, `metabase.util.honeysql-extensions/->AtTimeZone` has been removed; us
- The `:expressions` map in an MBQL query now uses strings as keys rather than keywords (see
[#14647](https://github.com/metabase/metabase/issues/14647)). You only need to be concerned with this if you are
accessing or manipulating this map directly. Drivers deriving from `:sql` implementing `->honeysql` for `[<driver>
:expression]` may need to be updated. A utility function, `metabase.mbql.util/expression-with-name`, has been
accessing or manipulating this map directly. Drivers deriving from `:sql` implementing `->honeysql` for `[<driver> :expression]` may need to be updated. A utility function, `metabase.mbql.util/expression-with-name`, has been
available since at least Metabase 0.35.0 and handles both types of keys. It is highly recommended that you use this
function rather than accessing `:expressions` directly, as doing so can make your driver compatible with both 0.42.0
and with 0.43.0 and newer.
......@@ -699,7 +698,7 @@ If you were manipulating Field or Table aliases, we consolidated a lot of overla
escaping disallowed characters), implement this method.
- `metabase.driver.sql-jdbc.sync.interface/filtered-syncable-schemas` has been added, and will eventually replace
`metabase.driver.sql-jdbc.sync.interface/syncable-schemas`. It serves a similar purpose, except that it's also
`metabase.driver.sql-jdbc.sync.interface/syncable-schemas`. It serves a similar purpose, except that it's also
passed the inclusion and exclusion patterns (ex: `auth*,data*`) to further filter schemas that will be synced.
### Deprecated methods and vars
......@@ -721,7 +720,7 @@ The following methods and vars are slated for removal in Metabase 0.45.0 unless
do something special; use the [#19610 information](https://github.com/metabase/metabase/pull/19610) if you need to escape the alias
for one reason or another. This method is still slated for removal in Metabase 0.44.0.
- `metabase.driver.sql.query-processor/*field-options*` is now unused and is no longer bound automatically. If you need field options for some reason, see our SQL Server driver for an example on how to create it.
- `metabase.driver.sql.query-processor/*field-options*` is now unused and is no longer bound automatically. If you need field options for some reason, see our SQL Server driver for an example on how to create it.
- `metabase.driver.sql.query-processor/*table-alias*` is now unused and is no longer bound automatically. Use or
override `:metabase.query-processor.util.add-alias-info/source-table` from the [#19610
......@@ -753,12 +752,12 @@ The following methods and vars are slated for removal in Metabase 0.45.0 unless
Before 0.42.0, this information was tracked in our Wiki. You can find changes for versions before 0.42.0 in the
table below:
| Version | Wiki page |
|---------|-----------|
| 0.41.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.41.0-for-Metabase-driver-authors) |
| 0.40.0 | No changes. |
| 0.39.0 | No changes. |
| 0.38.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.38.0-for-Metabase-driver-authors) |
| 0.37.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.37.0-for-Metabase-driver-authors) |
| 0.36.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.36.0-for-Metabase-driver-authors) |
| 0.35.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.35.0-for-Metabase-driver-authors) |
| Version | Wiki page |
| ------- | ----------------------------------------------------------------------------------------------------- |
| 0.41.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.41.0-for-Metabase-driver-authors) |
| 0.40.0 | No changes. |
| 0.39.0 | No changes. |
| 0.38.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.38.0-for-Metabase-driver-authors) |
| 0.37.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.37.0-for-Metabase-driver-authors) |
| 0.36.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.36.0-for-Metabase-driver-authors) |
| 0.35.0 | [changes](https://github.com/metabase/metabase/wiki/What's-new-in-0.35.0-for-Metabase-driver-authors) |
......@@ -207,7 +207,7 @@ be-tests-postgres-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 60
env:
CI: 'true'
CI: "true"
DRIVERS: postgres
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
......@@ -217,7 +217,7 @@ be-tests-postgres-latest-ee:
MB_POSTGRESQL_TEST_USER: circle_test
MB_POSTGRES_SSL_TEST_SSL: true
MB_POSTGRES_SSL_TEST_SSL_MODE: verify-full
MB_POSTGRES_SSL_TEST_SSL_ROOT_CERT_PATH: 'test-resources/certificates/us-east-2-bundle.pem'
MB_POSTGRES_SSL_TEST_SSL_ROOT_CERT_PATH: "test-resources/certificates/us-east-2-bundle.pem"
services:
postgres:
image: circleci/postgres:latest
......@@ -228,11 +228,11 @@ be-tests-postgres-latest-ee:
POSTGRES_DB: circle_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- name: Test Postgres driver (latest)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-postgres-latest-ee'
- uses: actions/checkout@v4
- name: Test Postgres driver (latest)
uses: ./.github/actions/test-driver
with:
junit-name: "be-tests-postgres-latest-ee"
```
For more on what it is you're doing here and how all this works, see [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions).
......@@ -13,17 +13,19 @@ Metabase’s Cypress tests are located in the `e2e/test/scenarios` source tree,
Our custom Cypress runner builds its own backend and creates a temporary H2 app db. Both are destroyed when this process is killed. The reserved default port is `4000` on the local host. There is nothing stopping you from running your local Metabase instance on `localhost:3000` at the same time. This might even be helpful for debugging purposes.
### Standard Development Flow
1. Continuously build the frontend
a. If you need only the frontend, run `yarn build-hot`
a. If you need only the frontend, run `yarn build-hot`
b. If you want to run a local Metabase instance alongside Cypress, the easiest way to achieve this is by using `yarn dev` or `yarn dev-ee` (both rely on frontend hot reloading under the hood)
b. If you want to run a local Metabase instance alongside Cypress, the easiest way to achieve this is by using `yarn dev` or `yarn dev-ee` (both rely on frontend hot reloading under the hood)
2. In a separate terminal session (without killing the previous one) run `yarn test-cypress-open`. This will open a Cypress GUI that will let you choose which tests to run. Alterantively, take a look at more running options below.
### Running Options
To run all Cypress tests programmatically in the terminal:
```sh
yarn run test-cypress-run
```
......@@ -49,12 +51,12 @@ Specifying a browser makes most sense when running Cypress in a _run_ mode. On t
Cypress test files are structured like Mocha tests, where `describe` blocks are used to group related tests, and `it` blocks are the tests themselves.
```js
describe("homepage",() => {
it('should load the homepage and...', () => {
describe("homepage", () => {
it("should load the homepage and...", () => {
cy.visit("/metabase/url");
// ...
})
})
});
});
```
We strongly prefer using selectors like `cy.findByText()` and `cy.findByLabelText()` from [`@testing-library/cypress`](https://github.com/testing-library/cypress-testing-library) since they encourage writing tests that don't depend on implementation details like CSS class names.
......@@ -63,21 +65,23 @@ Try to avoid repeatedly testing pieces of the application incidentally. For exam
## Cypress Documentation
* Introduction: https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html
* Commands: https://docs.cypress.io/api/api/table-of-contents.html
* Assertions: https://docs.cypress.io/guides/references/assertions.html
- Introduction: https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html
- Commands: https://docs.cypress.io/api/api/table-of-contents.html
- Assertions: https://docs.cypress.io/guides/references/assertions.html
## Tips/Gotchas
### `contains` vs `find` vs `get`
Cypress has a set of similar commands for selecting elements. Here are some tips for using them:
- [`contains`](https://docs.cypress.io/api/commands/contains) is (by default) case-sensitive to the text *in the DOM*. If it’s not matching text you’d expect, check that CSS hasn’t updated the case. You can explicitly tell it to ignore the case with the following option `{ matchCase: false }`.
- `contains` matches substrings. Given two strings “filter by” and “Add a filter”, `cy.contains(“filter”);` will match both. To avoid these issues, you can either pass a regexp that pins the start/end of the string or scope a string to a specific selector: `cy.contains(selector, content);`.
- [`contains`](https://docs.cypress.io/api/commands/contains) is (by default) case-sensitive to the text _in the DOM_. If it’s not matching text you’d expect, check that CSS hasn’t updated the case. You can explicitly tell it to ignore the case with the following option `{ matchCase: false }`.
- `contains` matches substrings. Given two strings “filter by” and “Add a filter”, `cy.contains(“filter”);` will match both. To avoid these issues, you can either pass a regexp that pins the start/end of the string or scope a string to a specific selector: `cy.contains(selector, content);`.
- [`find`](https://docs.cypress.io/api/commands/find) will let you search within your previous selection.
- [`get`](https://docs.cypress.io/api/commands/get) will search the entire page even if chained, unless you explicitly tweak the `withinSubject` option.
### How to access Sample Database tables and field IDs?
The Sample Database that we use in E2E tests can change at any time, and with it the references to its tables and fields. Never **ever** use hard coded numeric references to those IDs. We provide a helpful mechanism to achieve this that is guaranteed to produce correct results. Every time you spin Cypress up, it fetches the information about the Sample Database, extracts table and field IDs and writes that to the `e2e/support/cypress_sample_database` JSON that we then re-export and make available to all tests.
```js
......@@ -86,7 +90,7 @@ const query = {
"source-table": 1,
aggregation: [["count"]],
breakout: [["field", 7, null]],
}
};
// Do this instead
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
......@@ -96,7 +100,7 @@ const query = {
"source-table": PRODUCTS_ID,
aggregation: [["count"]],
breakout: [["field", PRODUCTS.CATEGORY, null]],
}
};
```
### Increase viewport size to avoid scrolling
......@@ -106,16 +110,19 @@ Sometimes Metabase views are a bit large for Cypress’ default 1280x800 viewpor
```js
describe("foo", { viewportWidth: 1400 }, () => {});
it("bar", { viewportWidth: 1600, viewportHeight: 1200 }, () => {})
it("bar", { viewportWidth: 1600, viewportHeight: 1200 }, () => {});
```
### Code reloading vs test reloading
When you edit a Cypress test file, the tests will refresh and run again. However, when you edit a code file, Cypress won’t detect that change. If you’re running `yarn build-hot`, the code will rebuild and update within Cypress. You’ll have to manually click rerun after the new code has loaded.
### Inspecting while the “contains helper” is open
One great feature of Cypress is that you can use the Chrome inspector after each step of a test. They also helpfully provide a helper that can test out `contains` and `get` calls. This helper creates new UI that prevents inspecting from targeting the correct elements. If you want to inspect the DOM in Chrome, you should close this helper.
### Putting the wrong HTML template in the Uberjar
`yarn build` and `yarn build-hot` each overwrite an HTML template to reference the correct JavaScript files. If you run `yarn build` before building an Uberjar for Cypress tests, you won’t see changes to your JavaScript reflected even if you then start `yarn build-hot`.
### Running Cypress on M1 machines
......@@ -152,6 +159,7 @@ Tests that depend on Snowplow expect a running server. To run them, you need to:
- pass env variables to the test run: `MB_SNOWPLOW_AVAILABLE=true MB_SNOWPLOW_URL=http://localhost:9090 yarn test-cypress-open`
## Testing with Snowplow
Our end-to-end testing environment has been configured to run Snowplow Micro alongside the application.
To run Snowplow locally use the following commands:
......@@ -181,8 +189,8 @@ We don't need to have [Lodash](https://lodash.com/) in our direct dependencies t
```js
// Run the test N times
Cypress._.times(N, ()=> {
it("should foo", ()=> {
Cypress._.times(N, () => {
it("should foo", () => {
// ...
});
});
......@@ -250,13 +258,17 @@ These are the tags currently in use:
Fixing a flaky test locally doesn't mean the fix works in GitHub's CI environment. The only way to be sure the fix works is to stress-test it in CI. That's what `.github/workflows/e2e-stress-test-flake-fix.yml` is made for. It allows you to quickly test the fix in your branch without waiting for the full build to complete.
Please follow these steps:
### Prepare
- Create a new branch with your proposed fix and push it to the remote
- Either skip opening a PR altogether or open a **draft** pull request
### Trigger the stress-test workflow manually
- Go to `https://github.com/metabase/metabase/actions/workflows/e2e-stress-test-flake-fix.yml`
- Click on _Run workflow_ trigger next to "This workflow has a workflow_dispatch event trigger."
1. Choose your own branch in the first field "Use workflow from" (this part is crucial!)
2. Copy and paste the relative path of the spec you want to test (e.g. `e2e/test/scenarios/onboarding/urls.cy.spec.js`) - you don't have to wrap it in quotes
3. Set the desired number of times to run the test
......@@ -264,8 +276,9 @@ Please follow these steps:
5. Click the green "Run workflow" button and wait for the results
### Things to keep in mind when using this workflow
- It will automatically try to find and download the previously built Metabase uberjar stored as an artifact from one of the past commits / CI runs.
- It was intended to be used for pure E2E fixes that don't require new Metabase uberjar.
- If the fix required a source-code change (either backend of frontend), please open a regular PR instead and let the CI run all tests first. After this,
you can trigger the stress-test workflow manually, as explained above, and it will automatically download newly built artifact from this CI run. Please,
keep in mind that CI needs to fully finish running first. The workflow uses GitHub REST API which doesn't see artifacts otherwise.
you can trigger the stress-test workflow manually, as explained above, and it will automatically download newly built artifact from this CI run. Please,
keep in mind that CI needs to fully finish running first. The workflow uses GitHub REST API which doesn't see artifacts otherwise.
......@@ -14,4 +14,4 @@ You'll probably want to tell Emacs to store customizations in a different file.
(setq custom-file (concat user-emacs-directory ".custom.el")) ; tell Customize to save customizations to ~/.emacs.d/.custom.el
(ignore-errors ; load customizations from ~/.emacs.d/.custom.el
(load-file custom-file))
```
\ No newline at end of file
```
......@@ -27,7 +27,6 @@ and in the backend using `trs` (to use the site language) or `tru` (to use the c
If you see incorrect or missing strings for your language, please visit our [POEditor project](https://poeditor.com/join/project/ynjQmwSsGh) and submit your fixes there.
# Backend Translation Guide
Metabase allows for translations into many languages. An authoritative list can be found in `resources/locales.clj`.
......@@ -78,4 +77,4 @@ Every string language needs an escape character. Since `{0}` is an argument to b
These is an unfortunate side effect of this though. Since the apostrophe is such a commeon part of speech (especially in french), we often can end up with escape characters used as a regular part of a string rather than the escape character. Format strings need to use double apostrophes like `(deferred-tru "SAML attribute for the user''s email address")` to escape the apostrophe.
There are lots of translated strings in French that use a single apostrophe incorrectly. (eg "l'URL" instead of "l''URL"). We have a manual fix to this in `bin/i18n/src/i18n/create_artifacts/backend.clj` where we try to identify these apostrophes which are not escape characters and replace them with a double quote.
\ No newline at end of file
There are lots of translated strings in French that use a single apostrophe incorrectly. (eg "l'URL" instead of "l''URL"). We have a manual fix to this in `bin/i18n/src/i18n/create_artifacts/backend.clj` where we try to identify these apostrophes which are not escape characters and replace them with a double quote.
......@@ -29,4 +29,3 @@ and documented in this changelog.
from a date or datetime.
- `extract` applies an extraction to the query.
- `extraction-expression` returns the expression for the extraction, allowing further editing.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment