Format argument unsupported for TO_CHAR/TO_VARCHAR function #2177
-
When processing some query (insert .. as select) (12k characters), I'm getting few of the messages from Title. Could you explain what does it mean? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
That's a warning that even though there's a What's the input/output dialect in your case? Can you show a small example of how you're trying to use SQLGlot? |
Beta Was this translation helpful? Give feedback.
-
Please check this example, there is coalesce, and cast on the write, and should not be: `from sqlglot import parse_one query = """ parsed = parse_one(query, dialect = 'postgres') unparsed = parsed.sql(pretty=True, dialect='postgres')` |
Beta Was this translation helpful? Give feedback.
Yes, you should provide both the intended read and the intended write dialects so that the parsing / SQL generation work correctly for them. So, if you're parsing a Postgres query you should do
parse_one(..., dialect="postgres")
and if you're generating postgres, doparsed_expression.sql(dialect="postgres")
.