MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / render_bind_cast

Method render_bind_cast

lib/sqlalchemy/dialects/postgresql/base.py:2084–2093  ·  view source on GitHub ↗
(self, type_, dbapi_type, sqltext)

Source from the content-addressed store, hash-verified

2082 return f"{element.name}{self.function_argspec(element, **kw)}"
2083
2084 def render_bind_cast(self, type_, dbapi_type, sqltext):
2085 if dbapi_type._type_affinity is sqltypes.String and dbapi_type.length:
2086 # use VARCHAR with no length for VARCHAR cast.
2087 # see #9511
2088 dbapi_type = sqltypes.STRINGTYPE
2089 return f"""{sqltext}::{
2090 self.dialect.type_compiler_instance.process(
2091 dbapi_type, identifier_preparer=self.preparer
2092 )
2093 }"""
2094
2095 def visit_array(self, element, **kw):
2096 if not element.clauses and not element.type.item_type._isnull:

Callers

nothing calls this directly

Calls 1

processMethod · 0.45

Tested by

no test coverage detected