Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MLv2] [BE] Lib.dependentMetadata does not return source cards #38312

Closed
Tracked by #36108
kamilmielnik opened this issue Jan 31, 2024 · 0 comments · Fixed by #38378
Closed
Tracked by #36108

[MLv2] [BE] Lib.dependentMetadata does not return source cards #38312

kamilmielnik opened this issue Jan 31, 2024 · 0 comments · Fixed by #38378
Assignees
Labels
.metabase-lib Label for tracking all issues related to the shared CLJC metabase-lib .Team/QueryProcessor :hammer_and_wrench: Type:Bug Product defects

Comments

@kamilmielnik
Copy link
Contributor

kamilmielnik commented Jan 31, 2024

To reproduce

Unit test

import { createSampleDatabase } from 'metabase-types/api/mocks/presets';
import * as Lib from 'metabase-lib';
import { createMockMetadata } from '__support__/metadata';

const SAMPLE_DATABASE = createSampleDatabase();

const SAMPLE_METADATA = createMockMetadata({
  databases: [SAMPLE_DATABASE],
});

const query = Lib.fromLegacyQuery(1, SAMPLE_METADATA, {
  type: 'query',
  query: {
    'source-table': 'card__5',
  },
  database: 1,
});

expect(Lib.dependentMetadata(query)).toEqual([
  { type: 'database', id: 1 },
  { type: 'schema', id: 1 },
  { type: 'table', id: 'card__5' },
]);

e2e test

  1. git checkout 37390-dependent-metadata
  2. Run e2e test title-drill.cy.spec.js -> should lead you to a table question with filtered ID (metabase#17213)

The dataset query is:

{
    "type": "query",
    "query": {
        "source-table": "card__5"
    },
    "database": 1
}

Outcome

Lib.dependentMetadata will return:

[
  { type: 'database', id: 1 },
  { type: 'schema', id: 1 },
]

While it should return:

[
  { type: 'database', id: 1 },
  { type: 'schema', id: 1 },
  { type: 'table', id: 'card__5' },
]
@kamilmielnik kamilmielnik added Type:Bug Product defects .metabase-lib Label for tracking all issues related to the shared CLJC metabase-lib .Team/QueryProcessor :hammer_and_wrench: labels Jan 31, 2024
@kamilmielnik kamilmielnik changed the title [MLv2] [BE] Lib.dependentMetadata does not return nested cards [MLv2] [BE] Lib.dependentMetadata does not return source cards Jan 31, 2024
@metamben metamben self-assigned this Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.metabase-lib Label for tracking all issues related to the shared CLJC metabase-lib .Team/QueryProcessor :hammer_and_wrench: Type:Bug Product defects
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants