Closed moseleyi closed 6 years ago
Hard to say why some data wouldn't show up, what happens if you test the sequelize call manually?
I added raw : true
on the main join and removed separate : true
but everything is the same - the 3rd level and down do not show up in GraphQL results despite the query having been built correctly.
When I put the breakpoint in resolver.js
and inspect values
after going 3 levels deep I can see my columns truncated to 5 characters - why is it truncated and where?
I guess one workaround could be to use very short aliases so that the column from 3rd level isn't like:
CompanyProjects.Projects.ProjectsSkills.created_at
as this gets very very long, but if I can't change the models (and adding aliases might screw things up) then what else can I do?
I checked a different connection that's not so deep but has long column names, it has also been truncate, the limit looks like something between 62-65 characters. Can we change it please?
-- EDIT
I found that it's an issue with PostgreSQL natural limit for label names, how can we stop appending all previous join table names so instead CompanyProjects.Projects.ProjectSkills
we only get ProjectSkills
?
Truncating/long names is a sequelize issue, graphql-sequelize has no way to solve this unless you just stop using includes and use batching instead.
After having searched for the reason why my 5th level join's column names were truncated to 5 characters I found the
separate:true
, which works fine for a clean read query.Now I want to apply a filter on the 4th level and even if the query is correct, the data returned in GraphQL is empty.
This is simplistic demonstration of how I'm doing it, the main table is
Companies
Then I'm trying to add a filter for the
skill_id
:But even if the separate query is correct (it applies
INNER JOIN
withIN
) then the data is not showing and also if I want to limit it to first 5 companies that have this skill, it will get 5 organizations first and then use them in the separate query, even though it doesn't mean that they have that skill.In this case I would like to remove
separate : true
but if I do that the data won't show up at all. I'm trying to find the place where SQL result is changed to JSON in Sequelize (I found it once where I could see the columns truncated) but can't find it again.. I understand this might be more Sequelize-related issue rather than GraphQL Sequelize so let me know if I should move it.Actually I found it now. The values are null, don't know why either but even the properties are not an actual column names - only 5 first characters. This comes from the 4th level, so the below is for
ProjectSkills
Those should be
created_at, updated_at, skill_id
andskill_details
which isn't showing up (because 2 x skill), and this is after removing allseparate
s so I only have one big query with lots of joins.