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

Add denomalized name columns to join tables #211

Merged
merged 1 commit into from
May 3, 2023
Merged

Conversation

jon-betts
Copy link
Contributor

@jon-betts jon-betts commented May 1, 2023

For:

Needed for testing:

Metabase doesn't handle joins which result in duplicated column names. It causes the columns to get confused, like 'name'. Adding these to the join tables is both convenient and works around the issue.

This also adds the organization public id where it makes sense, as we always want that too.

Testing notes

In h:

make services
make devdata
tox -e dev --run-command "python bin/run_data_task.py --config-file conf/development-app.ini --task report/create_from_scratch"

In LMS:

make services
make devdata
tox -e dev --run-command "python bin/run_data_task.py --config-file conf/development.ini --task report/create_from_scratch"

In Report:

make services
make devdata
tox -e dev --run-command "python bin/run_data_task.py --task report/create_from_scratch --no-python"

And test the refresh in Report:

tox -e dev --run-command "python bin/run_data_task.py --task report/refresh --no-python"

Metabase doesn't handle joins which result in duplicated column names.
It causes the columns to get confused, like 'name'. Adding these to the
join tables is both convenient and works around the issue.
@jon-betts jon-betts force-pushed the denormalized-join branch from b5daf27 to 4fa5000 Compare May 1, 2023 14:54
-- properly.
organizations.id AS organization_id,
organizations.name AS organization_name,
organizations.public_id AS organization_public_id,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've included the public id, because we nearly always want it in our reports, and it saves us a join. You can't present the name without it as a link, as the dashboard uses the public id as the key.

@jon-betts
Copy link
Contributor Author

I've found some ways around this, but it's not a bad idea anyway. Some ways to work around this:

  • When presenting links if you leave the link text empty, it usually shows the correct column
  • I've discovered you can pick table as the visualisation and then use settings to fix columns more reliably

@jon-betts jon-betts merged commit e755b09 into main May 3, 2023
@jon-betts jon-betts deleted the denormalized-join branch May 3, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants