Skip to content

Query Comments #3643

@davewasmer

Description

@davewasmer

Issue type:

[ ] question
[ ] bug report
[x] feature request
[ ] documentation issue

Would you be open to a PR that added support for "naming" queries? I.e. something like:

Post.createQueryBuilder()
  .comment(`Lookup all the posts in ${ category } category`)
  .where({ category })
  .getSql()

/*
-- Lookup all the posts in foo category
SELECT ...

It would only be stored / used in TypeORM, obviously not submitted to the driver layer.

I've found a few times where I'm trying to diagnose a API call that makes multiple complex queries and is failing due to an SQL error. I end up trying to read the generated SQL and trying to infer where in my code that query came from. It would be nice to be able to label the queries such that I could easily trace them back when the error causes TypeORM to dump getSql() output.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions