Create a chart Repartition with queries SQL

Expected behavior

Have the possibility to create a chart using key and value.

Actual behavior

Doesn’t want to work because key is a attribute we can’t use (MySQL/Mots réservés — Wikilivres)

Failure Logs

Please include any relevant log snippets, if necessary.

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version:
  • Sequelize Version:
  • Database Dialect:
  • Database Version:
  • Project Name:

Hi @Bastien_Blanc,

Thank you for reporting this issue.

In order to reproduce it on our end and work on a fix/workaround, would you mind sharing with me the SQL query that produces the error?

Thank you

@Bastien_Blanc, I just tested a similar query from the one you sent me though DM.

There is indeed an issue with the key keyword with MYSQL because it’s a reserved keyword.

However, if you put key between double quotes it should work properly and not be considered as the reserved keyword (see following example):

SELECT projects.name AS "key", COUNT(*) AS value
FROM projects
GROUP BY projects.name;

Let me know if you’re still facing issues with your query.

@anon37102731 This problem will be fix one day ?

Because the docs doesn’t speak about this “trick”.

It’s good now :slight_smile:
Bastien

Thank you for your feedback. I followed it to our product team. They should soon include the double quotes fix on the documentation.

best regards