diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4aa7bc8..abaa00c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,6 +65,16 @@ Once you are finished, stop the sandbox: make sandbox-down ``` +#### Recording + +Whenever tests require updating Metabase API fixtures, you need to "record" them from the running sandbox instance by executing: + +``` +RECORD=true make test +``` + +This will run tests against the actual Metabase instance, instead of fixtures, and write those responses to new fixtures. **Many tests will likely fail**, because of timestamps and other transient data, so you need to manually fix those assertions. + ## Code of Conduct All contributors are expected to follow the [PSF Code of Conduct](https://www.python.org/psf/conduct/). diff --git a/pyproject.toml b/pyproject.toml index 30e74a7..5547e18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,13 +64,14 @@ python_version = "3.8" [tool.ruff.lint] select = [ - "E", # pycodestyle errors - "W", # pycodestyle warnings - "F", # pyflakes - "I", # isort - "A", # flake8-builtins - "B", # flake8-bugbear - "C4", # flake8-comprehensions + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "A", # flake8-builtins + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "FIX001", # flake8-fixme ] ignore = [ "E501", # line-too-long diff --git a/sandbox/.gitignore b/sandbox/.gitignore index f008ba5..9c36dbc 100644 --- a/sandbox/.gitignore +++ b/sandbox/.gitignore @@ -1 +1 @@ -/metabase/metabase.db.trace.db +/metabase.db/metabase.db.trace.db diff --git a/sandbox/Dockerfile.metabase b/sandbox/Dockerfile.metabase deleted file mode 100644 index f30c5b4..0000000 --- a/sandbox/Dockerfile.metabase +++ /dev/null @@ -1,10 +0,0 @@ -FROM eclipse-temurin:11-jre - -ARG MB_VERSION -ARG CURL_FLAGS - -RUN curl -O ${CURL_FLAGS} https://downloads.metabase.com/v${MB_VERSION}/metabase.jar - -EXPOSE 3000 - -ENTRYPOINT ["java", "-jar", "metabase.jar"] diff --git a/sandbox/docker-compose.yml b/sandbox/docker-compose.yml index 2e5e189..71ce9ad 100644 --- a/sandbox/docker-compose.yml +++ b/sandbox/docker-compose.yml @@ -2,7 +2,7 @@ name: dbt-metabase-sandbox services: postgres: - image: postgres:16 + image: postgres:16.4 environment: - POSTGRES_USER=${POSTGRES_USER:-} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-} @@ -20,12 +20,7 @@ services: restart: always metabase: - # image: metabase/metabase:latest - build: - dockerfile: Dockerfile.metabase - args: - - MB_VERSION=0.50.5 - - CURL_FLAGS=${CURL_FLAGS:-} + image: metabase/metabase:v0.50.29 environment: - MB_SETUP_TOKEN=${MB_SETUP_TOKEN:-} - MB_DB_FILE=/metabase-data/metabase.db @@ -34,7 +29,7 @@ services: networks: - common volumes: - - ./metabase:/metabase-data + - ./metabase.db:/metabase-data/metabase.db healthcheck: test: ["CMD-SHELL", "curl --fail http://localhost:3000/api/health"] interval: 10s diff --git a/sandbox/metabase/metabase.db.mv.db b/sandbox/metabase.db/metabase.db.mv.db similarity index 51% rename from sandbox/metabase/metabase.db.mv.db rename to sandbox/metabase.db/metabase.db.mv.db index 123cfab..d693a78 100644 Binary files a/sandbox/metabase/metabase.db.mv.db and b/sandbox/metabase.db/metabase.db.mv.db differ diff --git a/tests/fixtures/api/card/27.json b/tests/fixtures/api/card/27.json index 2c32474..28e6045 100644 --- a/tests/fixtures/api/card/27.json +++ b/tests/fixtures/api/card/27.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": "Orders and customers", "archived": false, - "view_count": 425, + "view_count": 430, "collection_position": null, "table_id": 10, "can_run_adhoc_query": true, @@ -561,7 +561,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-10-12T02:16:15.081959Z", + "last_login": "2024-10-12T03:43:50.753203Z", "is_qbnewb": false, "is_superuser": true, "id": 1, @@ -578,7 +578,7 @@ "name": "Orders + Customers", "last_query_start": "2024-06-20T05:55:59.014926Z", "dashboard_count": 1, - "last_used_at": "2024-06-20T05:55:59.079272Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "average_query_time": 107.22222222222223, "creator_id": 1, diff --git a/tests/fixtures/api/card/28.json b/tests/fixtures/api/card/28.json index 68d6162..c6582fd 100644 --- a/tests/fixtures/api/card/28.json +++ b/tests/fixtures/api/card/28.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 212, + "view_count": 215, "collection_position": null, "table_id": 10, "can_run_adhoc_query": true, @@ -549,7 +549,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-10-12T02:16:15.081959Z", + "last_login": "2024-10-12T03:43:50.753203Z", "is_qbnewb": false, "is_superuser": true, "id": 1, @@ -566,7 +566,7 @@ "name": "Orders + Customers, Filtered by Status is completed", "last_query_start": "2024-06-19T12:09:31.377224Z", "dashboard_count": 1, - "last_used_at": "2024-06-19T12:09:31.689381Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "average_query_time": 264.0, "creator_id": 1, diff --git a/tests/fixtures/api/card/29.json b/tests/fixtures/api/card/29.json index 41caea7..af2552a 100644 --- a/tests/fixtures/api/card/29.json +++ b/tests/fixtures/api/card/29.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 211, + "view_count": 214, "collection_position": null, "table_id": null, "can_run_adhoc_query": true, @@ -41,7 +41,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-10-12T02:16:15.081959Z", + "last_login": "2024-10-12T03:43:50.753203Z", "is_qbnewb": false, "is_superuser": true, "id": 1, @@ -58,7 +58,7 @@ "name": "Returned Order Count SQL", "last_query_start": "2024-06-19T12:09:31.387065Z", "dashboard_count": 1, - "last_used_at": "2024-06-19T12:09:31.486489Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "average_query_time": 190.5, "creator_id": 1, diff --git a/tests/fixtures/api/card/30.json b/tests/fixtures/api/card/30.json index 3b44300..92cbfd3 100644 --- a/tests/fixtures/api/card/30.json +++ b/tests/fixtures/api/card/30.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": "Dummy 1", "archived": false, - "view_count": 37, + "view_count": 39, "collection_position": null, "table_id": null, "can_run_adhoc_query": true, @@ -41,7 +41,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-10-12T02:16:15.081959Z", + "last_login": "2024-10-12T03:43:50.753203Z", "is_qbnewb": false, "is_superuser": true, "id": 1, @@ -58,7 +58,7 @@ "name": "Dummy", "last_query_start": "2024-06-20T05:56:57.283068Z", "dashboard_count": 0, - "last_used_at": "2024-06-20T05:56:57.295379Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "average_query_time": 28.0, "creator_id": 1, diff --git a/tests/fixtures/api/card/31.json b/tests/fixtures/api/card/31.json index c6c0bad..2aea366 100644 --- a/tests/fixtures/api/card/31.json +++ b/tests/fixtures/api/card/31.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": "Dummy 2", "archived": false, - "view_count": 37, + "view_count": 39, "collection_position": null, "table_id": null, "can_run_adhoc_query": true, @@ -41,7 +41,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-10-12T02:16:15.081959Z", + "last_login": "2024-10-12T03:43:50.753203Z", "is_qbnewb": false, "is_superuser": true, "id": 1, @@ -58,7 +58,7 @@ "name": "Dummy", "last_query_start": "2024-06-20T05:57:12.286765Z", "dashboard_count": 0, - "last_used_at": "2024-06-20T05:57:12.297288Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "average_query_time": 24.0, "creator_id": 1, diff --git a/tests/fixtures/api/card/32.json b/tests/fixtures/api/card/32.json index 95438c5..1b1916f 100644 --- a/tests/fixtures/api/card/32.json +++ b/tests/fixtures/api/card/32.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": "CTE SQL", "archived": false, - "view_count": 28, + "view_count": 30, "collection_position": null, "table_id": null, "can_run_adhoc_query": true, @@ -276,7 +276,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-10-12T02:16:15.081959Z", + "last_login": "2024-10-12T03:43:50.753203Z", "is_qbnewb": false, "is_superuser": true, "id": 1, @@ -293,7 +293,7 @@ "name": "Completed Orders CTE SQL", "last_query_start": null, "dashboard_count": 0, - "last_used_at": null, + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "average_query_time": null, "creator_id": 1, diff --git a/tests/fixtures/api/card/33.json b/tests/fixtures/api/card/33.json index 1ef9cc8..d17e7d1 100644 --- a/tests/fixtures/api/card/33.json +++ b/tests/fixtures/api/card/33.json @@ -2,7 +2,7 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 9, + "view_count": 11, "collection_position": null, "table_id": 18, "can_run_adhoc_query": true, @@ -146,7 +146,7 @@ "creator": { "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", - "last_login": "2024-10-12T02:16:15.081959Z", + "last_login": "2024-10-12T03:43:50.753203Z", "is_qbnewb": false, "is_superuser": true, "id": 1, @@ -163,7 +163,7 @@ "name": "Transactions", "last_query_start": "2024-10-12T01:52:30.557471Z", "dashboard_count": 0, - "last_used_at": "2024-10-12T01:52:30.585371Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "average_query_time": 58.0, "creator_id": 1, diff --git a/tests/fixtures/api/collection/root/items.json b/tests/fixtures/api/collection/root/items.json index 95a371a..5cbf09b 100644 --- a/tests/fixtures/api/collection/root/items.json +++ b/tests/fixtures/api/collection/root/items.json @@ -3,7 +3,7 @@ "description": "CTE SQL", "collection_position": null, "can_write": true, - "database_id": null, + "database_id": 2, "collection_id": null, "name": "Completed Orders CTE SQL", "fully_parameterized": true, @@ -26,7 +26,7 @@ "description": "Dummy 1", "collection_position": null, "can_write": true, - "database_id": null, + "database_id": 2, "collection_id": null, "name": "Dummy", "fully_parameterized": true, @@ -49,7 +49,7 @@ "description": "Dummy 2", "collection_position": null, "can_write": true, - "database_id": null, + "database_id": 2, "collection_id": null, "name": "Dummy", "fully_parameterized": true, @@ -72,7 +72,7 @@ "description": "Orders and customers", "collection_position": null, "can_write": true, - "database_id": null, + "database_id": 2, "collection_id": null, "name": "Orders + Customers", "fully_parameterized": true, @@ -95,7 +95,7 @@ "description": null, "collection_position": null, "can_write": true, - "database_id": null, + "database_id": 2, "collection_id": null, "name": "Orders + Customers, Filtered by Status is completed", "fully_parameterized": true, @@ -118,7 +118,7 @@ "description": null, "collection_position": null, "can_write": true, - "database_id": null, + "database_id": 2, "collection_id": null, "name": "Returned Order Count SQL", "fully_parameterized": true, @@ -160,7 +160,7 @@ "description": null, "collection_position": null, "can_write": true, - "database_id": null, + "database_id": 2, "collection_id": null, "name": "Transactions", "fully_parameterized": true, diff --git a/tests/fixtures/api/dashboard/2.json b/tests/fixtures/api/dashboard/2.json index 11fc68d..b65c559 100644 --- a/tests/fixtures/api/dashboard/2.json +++ b/tests/fixtures/api/dashboard/2.json @@ -1,7 +1,7 @@ { "description": "Dashboard is a dashboard is a dashboard", "archived": false, - "view_count": 112, + "view_count": 114, "collection_position": null, "dashcards": [ { @@ -14,10 +14,9 @@ "cache_invalidated_at": null, "description": "Orders and customers", "archived": false, - "view_count": 424, + "view_count": 430, "collection_position": null, "table_id": 10, - "can_run_adhoc_query": true, "result_metadata": [ { "description": "This is a unique identifier for an order", @@ -577,7 +576,7 @@ "collection_id": null, "query_type": "query", "name": "Orders + Customers", - "last_used_at": "2024-06-20T05:55:59.079272Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "query_average_duration": 72, "creator_id": 1, @@ -654,10 +653,9 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 212, + "view_count": 215, "collection_position": null, "table_id": 10, - "can_run_adhoc_query": true, "result_metadata": [ { "description": null, @@ -1205,7 +1203,7 @@ "collection_id": null, "query_type": "query", "name": "Orders + Customers, Filtered by Status is completed", - "last_used_at": "2024-06-19T12:09:31.689381Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "query_average_duration": 129, "creator_id": 1, @@ -1268,10 +1266,9 @@ "cache_invalidated_at": null, "description": null, "archived": false, - "view_count": 211, + "view_count": 214, "collection_position": null, "table_id": null, - "can_run_adhoc_query": true, "result_metadata": [ { "display_name": "count", @@ -1311,7 +1308,7 @@ "collection_id": null, "query_type": "native", "name": "Returned Order Count SQL", - "last_used_at": "2024-06-19T12:09:31.486489Z", + "last_used_at": "2024-10-12T03:43:09.869884Z", "type": "question", "query_average_duration": 10, "creator_id": 1, diff --git a/tests/fixtures/api/database.json b/tests/fixtures/api/database.json index 4482e0c..fa0a6bf 100644 --- a/tests/fixtures/api/database.json +++ b/tests/fixtures/api/database.json @@ -8,6 +8,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -26,6 +27,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -39,11 +41,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -51,7 +55,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "native_permissions": "write", "cache_ttl": null, "details": { diff --git a/tests/fixtures/api/database/2/metadata.json b/tests/fixtures/api/database/2/metadata.json index 9b51d44..8ef5238 100644 --- a/tests/fixtures/api/database/2/metadata.json +++ b/tests/fixtures/api/database/2/metadata.json @@ -7,6 +7,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -25,6 +26,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -38,11 +40,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -408,7 +412,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 12, "db_id": 2, @@ -937,7 +941,7 @@ ], "caveats": "Some facts are derived from payments", "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 10, "db_id": 2, @@ -951,83 +955,6 @@ "estimated_row_count": 99, "points_of_interest": "Basic information only" }, - { - "description": null, - "entity_type": "entity/GenericTable", - "view_count": 0, - "schema": "public", - "database_require_filter": null, - "show_in_getting_started": false, - "name": "payments", - "fields": [ - { - "description": null, - "database_type": "int4", - "semantic_type": null, - "table_id": 17, - "coercion_strategy": null, - "database_indexed": null, - "name": "payment_id", - "fingerprint_version": 5, - "has_field_values": "list", - "settings": null, - "caveats": null, - "fk_target_field_id": null, - "updated_at": "2024-10-11T23:40:47.778573Z", - "custom_position": 0, - "effective_type": "type/Integer", - "active": true, - "nfc_path": null, - "parent_id": null, - "id": 110, - "last_analyzed": "2024-10-11T23:40:47.778573Z", - "database_partitioned": null, - "database_is_auto_increment": false, - "json_unfolding": false, - "position": 0, - "visibility_type": "normal", - "target": null, - "preview_display": true, - "display_name": "Payment ID", - "database_position": 0, - "database_required": false, - "fingerprint": { - "global": { - "distinct-count": 113, - "nil%": 0.0 - }, - "type": { - "type/Number": { - "min": 1.0, - "q1": 28.75, - "q3": 85.25, - "max": 113.0, - "sd": 32.76097144469315, - "avg": 57.0 - } - } - }, - "created_at": "2024-10-11T23:40:47.538901Z", - "base_type": "type/Integer", - "points_of_interest": null - } - ], - "caveats": null, - "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", - "active": true, - "id": 17, - "db_id": 2, - "visibility_type": null, - "field_order": "database", - "is_upload": false, - "initial_sync_status": "complete", - "display_name": "Payments", - "metrics": [], - "created_at": "2024-10-11T23:40:47.315991Z", - "estimated_row_count": 113, - "points_of_interest": null - }, { "description": null, "entity_type": "entity/GenericTable", @@ -1176,7 +1103,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 13, "db_id": 2, @@ -1386,7 +1313,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 14, "db_id": 2, @@ -1600,7 +1527,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 11, "db_id": 2, @@ -2002,7 +1929,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 15, "db_id": 2, @@ -2231,7 +2158,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 9, "db_id": 2, @@ -2509,7 +2436,7 @@ ], "caveats": null, "segments": [], - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 18, "db_id": 2, @@ -2526,7 +2453,7 @@ ], "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, diff --git a/tests/fixtures/api/table.json b/tests/fixtures/api/table.json index 5e5c289..41edf4f 100644 --- a/tests/fixtures/api/table.json +++ b/tests/fixtures/api/table.json @@ -14,6 +14,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -32,6 +33,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -45,11 +47,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -57,7 +61,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -92,7 +96,7 @@ "show_in_getting_started": false, "name": "customers", "caveats": null, - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 12, "db_id": 2, @@ -120,6 +124,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -138,6 +143,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -151,11 +157,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -163,7 +171,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -198,7 +206,7 @@ "show_in_getting_started": false, "name": "orders", "caveats": "Some facts are derived from payments", - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 10, "db_id": 2, @@ -226,6 +234,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -244,6 +253,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -257,11 +267,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -269,113 +281,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", - "cache_ttl": null, - "details": { - "ssl": false, - "password": "**MetabasePass**", - "port": 5432, - "advanced-options": false, - "schema-filters-type": "all", - "dbname": "dbtmetabase", - "host": "postgres", - "tunnel-enabled": false, - "user": "dbtmetabase" - }, - "is_sample": false, - "id": 2, - "is_on_demand": false, - "engine": "postgres", - "initial_sync_status": "complete", - "is_audit": false, - "dbms_version": { - "flavor": "PostgreSQL", - "version": "16.4 (Debian 16.4-1.pgdg120+2)", - "semantic-version": [ - 16, - 4 - ] - }, - "uploads_enabled": false, - "refingerprint": false, - "created_at": "2024-06-19T11:49:38.313316Z", - "points_of_interest": null - }, - "show_in_getting_started": false, - "name": "payments", - "caveats": null, - "updated_at": "2024-10-12T02:11:00.183707Z", - "active": true, - "id": 17, - "db_id": 2, - "visibility_type": null, - "field_order": "database", - "is_upload": false, - "initial_sync_status": "complete", - "display_name": "Payments", - "created_at": "2024-10-11T23:40:47.315991Z", - "estimated_row_count": 113, - "points_of_interest": null - }, - { - "description": null, - "entity_type": "entity/GenericTable", - "view_count": 0, - "schema": "public", - "database_require_filter": null, - "db": { - "uploads_schema_name": null, - "description": null, - "features": [ - "index-info", - "full-join", - "window-functions/cumulative", - "basic-aggregations", - "temporal-extract", - "actions/custom", - "window-functions/offset", - "now", - "convert-timezone", - "nested-field-columns", - "standard-deviation-aggregations", - "test/jvm-timezone-setting", - "date-arithmetics", - "persist-models", - "actions", - "expression-aggregations", - "percentile-aggregations", - "connection-impersonation", - "foreign-keys", - "table-privileges", - "right-join", - "left-join", - "native-parameters", - "schemas", - "nested-queries", - "expressions", - "uploads", - "set-timezone", - "regex", - "case-sensitivity-string-filter-options", - "binning", - "metadata/key-constraints", - "datetime-diff", - "upload-with-auto-pk", - "inner-join", - "advanced-math-expressions", - "fingerprint" - ], - "uploads_table_prefix": null, - "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", - "auto_run_queries": true, - "metadata_sync_schedule": "0 11 * * * ? *", - "name": "dbtmetabase", - "settings": null, - "caveats": null, - "creator_id": 1, - "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -410,7 +316,7 @@ "show_in_getting_started": false, "name": "raw_customers", "caveats": null, - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 13, "db_id": 2, @@ -438,6 +344,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -456,6 +363,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -469,11 +377,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -481,7 +391,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -516,7 +426,7 @@ "show_in_getting_started": false, "name": "raw_orders", "caveats": null, - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 14, "db_id": 2, @@ -544,6 +454,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -562,6 +473,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -575,11 +487,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -587,7 +501,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -622,7 +536,7 @@ "show_in_getting_started": false, "name": "raw_payments", "caveats": null, - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 11, "db_id": 2, @@ -650,6 +564,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -668,6 +583,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -681,11 +597,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -693,7 +611,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -756,6 +674,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -774,6 +693,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -787,11 +707,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -799,7 +721,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -834,7 +756,7 @@ "show_in_getting_started": false, "name": "stg_orders", "caveats": null, - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 15, "db_id": 2, @@ -862,6 +784,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -880,6 +803,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -893,11 +817,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -905,7 +831,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -940,7 +866,7 @@ "show_in_getting_started": false, "name": "stg_payments", "caveats": null, - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 9, "db_id": 2, @@ -968,6 +894,7 @@ "window-functions/cumulative", "basic-aggregations", "temporal-extract", + "identifiers-with-spaces", "actions/custom", "window-functions/offset", "now", @@ -986,6 +913,7 @@ "right-join", "left-join", "native-parameters", + "uuid-type", "schemas", "nested-queries", "expressions", @@ -999,11 +927,13 @@ "upload-with-auto-pk", "inner-join", "advanced-math-expressions", - "fingerprint" + "fingerprint", + "native-parameter-card-reference" ], "uploads_table_prefix": null, "cache_field_values_schedule": "0 0 5 * * ? *", - "timezone": "Etc/UTC", + "timezone": "GMT", + "is_attached_dwh": false, "auto_run_queries": true, "metadata_sync_schedule": "0 11 * * * ? *", "name": "dbtmetabase", @@ -1011,7 +941,7 @@ "caveats": null, "creator_id": 1, "is_full_sync": true, - "updated_at": "2024-10-12T01:52:11.286632Z", + "updated_at": "2024-10-12T03:43:24.194904Z", "cache_ttl": null, "details": { "ssl": false, @@ -1046,7 +976,7 @@ "show_in_getting_started": false, "name": "transactions", "caveats": null, - "updated_at": "2024-10-12T02:11:00.183707Z", + "updated_at": "2024-10-12T03:43:30.101325Z", "active": true, "id": 18, "db_id": 2, diff --git a/tests/fixtures/api/user/1.json b/tests/fixtures/api/user/1.json index b8b196c..88be00e 100644 --- a/tests/fixtures/api/user/1.json +++ b/tests/fixtures/api/user/1.json @@ -2,7 +2,7 @@ "email": "dbtmetabase@example.com", "first_name": "dbtmetabase", "locale": null, - "last_login": "2024-10-12T02:16:15.081959Z", + "last_login": "2024-10-12T03:43:50.753203Z", "is_active": true, "user_group_memberships": [ { @@ -13,7 +13,7 @@ } ], "is_qbnewb": false, - "updated_at": "2024-10-12T02:16:15.081959Z", + "updated_at": "2024-10-12T03:43:50.753203Z", "is_superuser": true, "login_attributes": null, "id": 1, diff --git a/tests/fixtures/exposure/collection/our_analytics.yml b/tests/fixtures/exposure/collection/our_analytics.yml index d253c21..b9faecf 100644 --- a/tests/fixtures/exposure/collection/our_analytics.yml +++ b/tests/fixtures/exposure/collection/our_analytics.yml @@ -14,6 +14,8 @@ exposures: email: dbtmetabase@example.com depends_on: - ref('orders') + meta: + last_used_at: '2024-10-12T03:43:09.869884Z' - name: dummy label: Dummy description: '### Visualization: Table @@ -48,7 +50,7 @@ exposures: depends_on: [] meta: average_query_time: '0:00.028' - last_used_at: '2024-06-20T05:56:57.295379Z' + last_used_at: '2024-10-12T03:43:09.869884Z' - name: dummy_1 label: Dummy description: '### Visualization: Table @@ -83,7 +85,7 @@ exposures: depends_on: [] meta: average_query_time: '0:00.024' - last_used_at: '2024-06-20T05:57:12.297288Z' + last_used_at: '2024-10-12T03:43:09.869884Z' - name: orders___customers label: Orders + Customers description: '### Visualization: Table @@ -110,7 +112,7 @@ exposures: - ref('orders') meta: average_query_time: '0:00.107' - last_used_at: '2024-06-20T05:55:59.079272Z' + last_used_at: '2024-10-12T03:43:09.869884Z' - name: orders___customers__filtered_by_status_is_completed label: Orders + Customers, Filtered by Status is completed description: '### Visualization: Table @@ -137,7 +139,7 @@ exposures: - ref('orders') meta: average_query_time: '0:00.264' - last_used_at: '2024-06-19T12:09:31.689381Z' + last_used_at: '2024-10-12T03:43:09.869884Z' - name: returned_order_count_sql label: Returned Order Count SQL description: "### Visualization: Scalar\n\nNo description provided in Metabase\n\ @@ -155,7 +157,7 @@ exposures: - ref('stg_payments') meta: average_query_time: '0:00.191' - last_used_at: '2024-06-19T12:09:31.486489Z' + last_used_at: '2024-10-12T03:43:09.869884Z' - name: the_dashboard label: The Dashboard description: '### Dashboard Cards: 3 @@ -207,4 +209,4 @@ exposures: - ref('payments') meta: average_query_time: '0:00.058' - last_used_at: '2024-10-12T01:52:30.585371Z' + last_used_at: '2024-10-12T03:43:09.869884Z' diff --git a/tests/fixtures/exposure/default/exposures.yml b/tests/fixtures/exposure/default/exposures.yml index c5b3559..5375c51 100644 --- a/tests/fixtures/exposure/default/exposures.yml +++ b/tests/fixtures/exposure/default/exposures.yml @@ -14,6 +14,8 @@ exposures: email: dbtmetabase@example.com depends_on: - ref('orders') + meta: + last_used_at: '2024-10-12T03:43:09.869884Z' tags: - metabase - name: dummy @@ -50,7 +52,7 @@ exposures: depends_on: [] meta: average_query_time: '0:00.028' - last_used_at: '2024-06-20T05:56:57.295379Z' + last_used_at: '2024-10-12T03:43:09.869884Z' tags: - metabase - name: dummy_1 @@ -87,7 +89,7 @@ exposures: depends_on: [] meta: average_query_time: '0:00.024' - last_used_at: '2024-06-20T05:57:12.297288Z' + last_used_at: '2024-10-12T03:43:09.869884Z' tags: - metabase - name: orders___customers @@ -116,7 +118,7 @@ exposures: - ref('orders') meta: average_query_time: '0:00.107' - last_used_at: '2024-06-20T05:55:59.079272Z' + last_used_at: '2024-10-12T03:43:09.869884Z' tags: - metabase - name: orders___customers__filtered_by_status_is_completed @@ -145,7 +147,7 @@ exposures: - ref('orders') meta: average_query_time: '0:00.264' - last_used_at: '2024-06-19T12:09:31.689381Z' + last_used_at: '2024-10-12T03:43:09.869884Z' tags: - metabase - name: returned_order_count_sql @@ -165,7 +167,7 @@ exposures: - ref('stg_payments') meta: average_query_time: '0:00.191' - last_used_at: '2024-06-19T12:09:31.486489Z' + last_used_at: '2024-10-12T03:43:09.869884Z' tags: - metabase - name: the_dashboard @@ -221,6 +223,6 @@ exposures: - ref('payments') meta: average_query_time: '0:00.058' - last_used_at: '2024-10-12T01:52:30.585371Z' + last_used_at: '2024-10-12T03:43:09.869884Z' tags: - metabase diff --git a/tests/fixtures/exposure/type/card/27.yml b/tests/fixtures/exposure/type/card/27.yml index 25b3034..d725255 100644 --- a/tests/fixtures/exposure/type/card/27.yml +++ b/tests/fixtures/exposure/type/card/27.yml @@ -26,4 +26,4 @@ exposures: - ref('orders') meta: average_query_time: '0:00.107' - last_used_at: '2024-06-20T05:55:59.079272Z' + last_used_at: '2024-10-12T03:43:09.869884Z' diff --git a/tests/fixtures/exposure/type/card/28.yml b/tests/fixtures/exposure/type/card/28.yml index bf2d27b..0af2c2b 100644 --- a/tests/fixtures/exposure/type/card/28.yml +++ b/tests/fixtures/exposure/type/card/28.yml @@ -26,4 +26,4 @@ exposures: - ref('orders') meta: average_query_time: '0:00.264' - last_used_at: '2024-06-19T12:09:31.689381Z' + last_used_at: '2024-10-12T03:43:09.869884Z' diff --git a/tests/fixtures/exposure/type/card/29.yml b/tests/fixtures/exposure/type/card/29.yml index b724a4b..3155ef1 100644 --- a/tests/fixtures/exposure/type/card/29.yml +++ b/tests/fixtures/exposure/type/card/29.yml @@ -17,4 +17,4 @@ exposures: - ref('stg_payments') meta: average_query_time: '0:00.191' - last_used_at: '2024-06-19T12:09:31.486489Z' + last_used_at: '2024-10-12T03:43:09.869884Z' diff --git a/tests/fixtures/exposure/type/card/30.yml b/tests/fixtures/exposure/type/card/30.yml index 3b101a8..dc23b08 100644 --- a/tests/fixtures/exposure/type/card/30.yml +++ b/tests/fixtures/exposure/type/card/30.yml @@ -34,4 +34,4 @@ exposures: depends_on: [] meta: average_query_time: '0:00.028' - last_used_at: '2024-06-20T05:56:57.295379Z' + last_used_at: '2024-10-12T03:43:09.869884Z' diff --git a/tests/fixtures/exposure/type/card/31.yml b/tests/fixtures/exposure/type/card/31.yml index e459b00..ccca6b4 100644 --- a/tests/fixtures/exposure/type/card/31.yml +++ b/tests/fixtures/exposure/type/card/31.yml @@ -34,4 +34,4 @@ exposures: depends_on: [] meta: average_query_time: '0:00.024' - last_used_at: '2024-06-20T05:57:12.297288Z' + last_used_at: '2024-10-12T03:43:09.869884Z' diff --git a/tests/fixtures/exposure/type/card/32.yml b/tests/fixtures/exposure/type/card/32.yml index 18b46bb..2e5a899 100644 --- a/tests/fixtures/exposure/type/card/32.yml +++ b/tests/fixtures/exposure/type/card/32.yml @@ -14,3 +14,5 @@ exposures: email: dbtmetabase@example.com depends_on: - ref('orders') + meta: + last_used_at: '2024-10-12T03:43:09.869884Z' diff --git a/tests/fixtures/exposure/type/card/33.yml b/tests/fixtures/exposure/type/card/33.yml index be2907c..6605c3c 100644 --- a/tests/fixtures/exposure/type/card/33.yml +++ b/tests/fixtures/exposure/type/card/33.yml @@ -25,4 +25,4 @@ exposures: - ref('payments') meta: average_query_time: '0:00.058' - last_used_at: '2024-10-12T01:52:30.585371Z' + last_used_at: '2024-10-12T03:43:09.869884Z' diff --git a/tests/test_models.py b/tests/test_models.py index db0a877..f42b1e2 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -63,9 +63,6 @@ def test_build_lookups(core: MockDbtMetabase): "BANK_TRANSFER_AMOUNT", "GIFT_CARD_AMOUNT", }, - "PUBLIC.PAYMENTS": { - "PAYMENT_ID", # TODO: why? - }, "PUBLIC.TRANSACTIONS": { "PAYMENT_ID", "PAYMENT_METHOD",