-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
SQL queries in GraphQL do not return results anymore #16201
Comments
This must be something else, not sure what the error is. It's not showing up with a new site. |
In the repro you said to try with a new site, but then you commented it's not applicable to a new site. Which one is the repro? |
Yeah, I'm super confused ATM 🙈 |
To Reproduce
So, this error occurs after some editing has been done. Seems to be related to versioning the items or something like that. (PS.: I updated the original repro steps as well.) |
There's this simpler repro:
Running the SQL Query directly (i.e. go to Queries, Run) correctly returns both Posts. Nothing seems suspicious: [
{
"Id": 15,
"DocumentId": 18,
"ContentItemId": "4f78wgf3hdfgvsh78vha32c1wy",
"ContentItemVersionId": "40157dyvtp1tp2mgb77t2jzrw2",
"Latest": 1,
"Published": 1,
"ContentType": "BlogPost",
"ModifiedUtc": "2024-05-31 12:45:45.2139249",
"PublishedUtc": "2024-05-31 12:45:45.2267931",
"CreatedUtc": "2024-05-31 12:45:45.2139249",
"Owner": "464qygsbznkmrswe1jsdqe3kxs",
"Author": "admin",
"DisplayText": "Demo"
},
{
"Id": 10,
"DocumentId": 10,
"ContentItemId": "4c5nda7x5rgq1v8mtxv654rgmz",
"ContentItemVersionId": "42pm5ntv0zxjswvm0161x8p4m8",
"Latest": 1,
"Published": 1,
"ContentType": "BlogPost",
"ModifiedUtc": "2024-05-31 12:45:00.5585245",
"PublishedUtc": "2024-05-31 12:45:00.5664133",
"CreatedUtc": "2024-05-31 12:45:00.5568733",
"Owner": "464qygsbznkmrswe1jsdqe3kxs",
"Author": "admin",
"DisplayText": "Man must explore, and this is exploration at its greatest"
}
] |
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues). This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here. |
And I did not find when this broke 🤷♂️ |
The issue is that (in my above example) the The issue is that Changing the query to this fixes the issue: SELECT DocumentId FROM ContentItemIndex WHERE ContentType='BlogPost' ORDER BY CreatedUtc DESC LIMIT 3 However, I'm unsure about how to tackle this:
What do you think? |
Oh, I should have seen that. I only checked the "return documents" field and it started to work. So I never actually checked the query itself 🙈 I think this is not a bug then... Thanks a lot for your help! |
I don't think it's worth changing anything here. Note to myself: one must create a correct query :) |
I think this is indeed a bug, just not in SQL Query, but perhaps the recipe (though it only really surfaces an issue if you try to use it with GraphQL) and and an omission in the documentation. |
So, I think this docs section should include that the query should select a column containing a document ID. And the Query in the recipe should select |
The query in the recipe does not return documents, so it's correct on its own IMHO. But maybe we can detect those errors and make it harder for people to fall into the same trap as I did. |
It's not incorrect but it's unnecessary, since for its default usage in a template you also only need the document ID. We could also add a hint to the checkbox BTW. Not sure but maybe we need something similar for Lucene and Elasticsearch Queries too. |
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues). This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here. |
@Piedone The blog recipe actually used a wrong property name in the SQL query step. I also made the Sql query source a little bit more forgiving by trying to get the correct column. Only if no |
Describe the bug
There is a regression in the latest version (main branch). A SQL query does not return any results when used in a GraphQL query.
To Reproduce
Screenshots
It looks like
_session.GetAsync<ContentItem>()
does not return anything.The text was updated successfully, but these errors were encountered: