Possible Issue when Transpiling from Spark to Athena? #5124
-
Hello! I'm new to sqlglot and it is amazing. I'm attempting to transpile a set of SQL queries written in Spark into Athena. I'm running into an issue where the file format isn't getting quoted during transpilation: import sqlglot
translated = sqlglot.transpile(
'CREATE TABLE `db`.`tab` USING parquet AS SELECT 1 AS `col`',
read="spark",
write="athena",
pretty=False
)[0]
print(translated) The current output is: The desired output is parquet wrapped in single quotes to represent a string literal: Is this something sqlglot is supposed to handle? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hiya 👋 Is this a syntax error in Athena? What about Presto and Trino that Athena's based on? If it's indeed invalid, it should be a low lift to fix this, by overriding the generation logic for
DDL and DML statements are usually not as highly prioritized, but yes, SQLGlot aims to transpile as much as possible. Since this isn't in scope for the core team, I'm going to mark as resolved, but we're happy to accept contributions if you're down to tackle this yourself! |
Beta Was this translation helpful? Give feedback.
Hiya 👋
Is this a syntax error in Athena? What about Presto and Trino that Athena's based on? If it's indeed invalid, it should be a low lift to fix this, by overriding the generation logic for
FileFormatProperty
and producing the string literal syntax you've shown.DDL and DML statements are usually not as highly prioritized, but yes, SQLGlot aims to transpile as much as possible.
Since this isn't in scope for the core team, I'm going to mark as resolved, but we're happy to accept contributions if you're down to tackle this yourself!