elementary icon indicating copy to clipboard operation
elementary copied to clipboard

Use ` instead of " to wrap database_and_schema in Slack for "The test query was too long, here's a query to get it."

Open mschmidoev opened this issue 4 months ago • 6 comments

Describe the bug When "The test query was too long, here's a query to get it." runs it posts the database_and_schema with quotation " marks around it. This causes the query not to run in SQL query editors like Datagrip or Databricks as it's incorrect syntax.

Currently it's returning this in Slack Test query The test query was too long, here's a query to get it.

SELECT test_results_query FROM "database.schema".elementary_test_results WHERE test_execution_id = '1234.test.xyz.test_model_name'

Expected behavior Would be better if it returned it wrapped in backticks ` so it could run straight from copying and pasting without any editing needed. So ideally it would return this: Test query The test query was too long, here's a query to get it.

SELECT test_results_query FROM `database.schema`.elementary_test_results WHERE test_execution_id = '1234.test.xyz.test_model_name'

Screenshot Image

Would you be willing to contribute a fix for this issue? Yes, will post PR shortly

mschmidoev avatar Aug 19 '25 01:08 mschmidoev

Thanks @mschmidoev ! We'll have a look.

NoyaOffer avatar Aug 19 '25 11:08 NoyaOffer

Hi @mschmidoev!

If I understand correctly, the quoting rules depend on the SQL dialect being used. Databases that follow Standard SQL (ANSI), like PostgresQL, use double quotes for identifiers. Other databases may use backticks (MySQL) or even square brackets (SQL server).

If this is indeed the case, I would prefer to stick with Standard SQL. What's your thoughts on it?

elazarlachkar avatar Aug 24 '25 10:08 elazarlachkar

Thanks @elazarlachkar and @NoyaOffer. Ah sorry, I think I wasn't very clear, and I think I need to update my PR and description which I'll do in a sec. The issue isn't the identifiers actually, it's because it's joining the database and schema together like "database.schema" which treats the whole thing as one identifier. Would be best to split it into "database"."schema"

mschmidoev avatar Aug 25 '25 00:08 mschmidoev

@mschmidoev Got you, that's make sense :) I approved the PR, thanks for the contribution!

elazarlachkar avatar Aug 25 '25 12:08 elazarlachkar

Thanks @elazarlachkar, looking forward to this change getting merged. Let me know if there's anything I still need to do :)

mschmidoev avatar Aug 26 '25 01:08 mschmidoev

This issue is stale because it has been open for too long with no activity. If you would like the issue to remain open, please remove the stale label or leave a comment.

github-actions[bot] avatar Nov 13 '25 02:11 github-actions[bot]