superset
superset copied to clipboard
HOURS OFFSET applies only to 1 time column, it should apply to all temporal columns in the dataset
In Dataset Settings there is an option called "HOURS OFFSET". When you have only one time column, it's working as expected: it adds the corresponding number of hours to the time column while outputting it on the chart. However, when you have more than one temporal columns, the number of hours is logically expected to be added to all of them. Now it adds to only the one column that is selected as the "TIME COLUMN" in the chart.
How to reproduce the bug
- Create a dataset with more than one temporal field (e.g. Creation and expiration dates, as in the screencast),
- Add "HOURS OFFSET" to the dataset settings (e.g. 4) and save the dataset,
- Choose a "TIME COLUMN" in the Time settings of the chart and click Update,
- Choose another "TIME COLUMN" and click Update
Expected results
X hours (set in "HOURS OFFSET") should be added to all temporal fields, regardless of the "TIME COLUMN" selected.
Actual results
X hours are added to only one column, the one that is selected as the "TIME COLUMN" in the chart.
Note, that in the screencast, the "Expire Date" of the bottom row is actually equal to the "Agreement Creation Date" of the top row, but they are displayed with a 4-hour difference either way, because of the "HOURS OFFSET" option set.
Screenshots
https://user-images.githubusercontent.com/43491361/220833739-32950223-19ba-40e4-be12-d09804c40fde.mp4
Note, that the "Expire Date" of the bottom row is actually equal to the "Agreement Creation Date" of the top row, but they are displayed with a 4-hour difference either way, because of the "HOURS OFFSET" option set.
Environment
(please complete the following information):
- browser type and version: Version 110.0.5481.112 (Official Build) (64-bit)
- superset version:
latest
(checked onlatest-dev
too) - any feature flags active: "DASHBOARD_CROSS_FILTERS": True, "ALERT_REPORTS": True, "ENABLE_TEMPLATE_PROCESSING": True, "ENABLE_TEMPLATE_REMOVE_FILTERS": True, "GENERIC_CHART_AXES": True
Checklist
Make sure to follow these steps before submitting your issue - thank you!
- [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [x] I have reproduced the issue with at least the latest released version of superset.
- [x] I have checked the issue tracker for the same issue and I haven't found one similar.
EDIT Ok I think I misread your intent
You want both relationships to be from entityA
to entityA
- ok
- create 2
ManyToMany
relationships betweenentityA
and itself - edit the resulting file and add table names to the relationships using
@ORM\JoinTable
Example of 2 ManyToMany
relationships between EntityA
and itself with inverse mapping:
/**
* @ORM\ManyToMany(targetEntity=EntityA::class, inversedBy="children1")
* @ORM\JoinTable(name="relationshipA")
*/
private $parent1;
/**
* @ORM\ManyToMany(targetEntity=EntityA::class, mappedBy="parent1")
*/
private $children1;
/**
* @ORM\ManyToMany(targetEntity=EntityA::class, inversedBy="children2")
* @ORM\JoinTable(name="relationshipB")
*/
private $parent2;
/**
* @ORM\ManyToMany(targetEntity=EntityA::class, mappedBy="parent2")
*/
private $children2;
This will create tables relationshipA
and relationshipB
Old answer below
Never tried 2 ManyToMany
relationships between the same 2 entities
but here's something you could try (should work theoretically):
-
bin/console make:entity entityAname
- create a
ManyToMany
relationship withentity entityBname
- should create tableentityAname_entityBname
- exit
entity
editing -
bin/console make:entity entityBname
- create a
ManyToMany
relationship withentity entityAname
- should create tableentityBname_entityAname
you should now have 2 tables that do a ManyToMany
relationship between those 2 entities
@537mfb's solution worked for me!
In my case, I was creating multiple many-to-many between EntityA
and EntityB
for different columns in EntityA
I think a unique relationship name should be automatically generated when the user does not explicitly state the @ORM\JoinTable(name="relationshipName")
to prevent this duplicate error
It does create a name - however the name (if i remember correctly) is entityAHasentityB by default so both would many to many relationships would have the same name (hence the duplicate error) I guess if the two entities aren't the same (which they were in @Lukas-Sander's case) you could possibly edit entityA, add a ManyToMany relationship to entityB then edit entityB and add a ManyToMany relationship to entityA If done corretly that would produce one mappedBy and one InversedBy property in each entity, and an EntityAHasEntityB and EntityBHasEntityA relationship entities - but I haven't tested this as I prefer a bit more control in complex cases like this (check my Old answer at the bottom of my answer above for details)