Skip to content

Commit

Permalink
Update sqlalchemy_presto.py add try_cast
Browse files Browse the repository at this point in the history
Update sqlalchemy_presto.py add try_cast
  • Loading branch information
pinohans authored Jan 21, 2025
1 parent b0f3c00 commit e146aa5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/pyhive/sqlalchemy_presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class PrestoCompiler(SQLCompiler):
def visit_char_length_func(self, fn, **kw):
return 'length{}'.format(self.function_argspec(fn, **kw))

def visit_try_cast(self, element, **kw):
return f"try_cast({self.process(element.clause, **kw)} as {self.process(element.typeclause, **kw)})"

class PrestoTypeCompiler(compiler.GenericTypeCompiler):
def visit_CLOB(self, type_, **kw):
Expand Down

0 comments on commit e146aa5

Please sign in to comment.