Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def visit_FuncAliasNode(self, node):
self.write(common.quote_ident(node.alias))
if node.elements:
self.write(' (')
count = len(node.elements)
for i, expr in enumerate(node.elements):
self.visit(expr)
if i != count - 1:
self.write(', ')
self.write(')')
def visit_SelectExprNode(self, node):
self.visit(node.expr)
if node.alias:
self.write(' AS ' + common.quote_ident(node.alias))
def visit_CTENode(self, node):
if isinstance(node.alias, str):
self.write(common.quote_ident(node.alias))
else:
self.write(common.quote_ident(node.alias.alias))
async def code(self, context):
code = super().prefix_code(context)
code += ' RENAME TO %s ' % common.quote_ident(self.new_name)
return code
def constraint_name(self, quote=True):
if quote and self._constraint_name:
return common.quote_ident(self._constraint_name)
else:
return self._constraint_name
async def code(self, context):
return 'CREATE SCHEMA %s' % common.quote_ident(self.name)
async def code(self, context):
return '''ALTER SCHEMA {} RENAME TO {}'''.format(
common.quote_ident(self.name),
common.quote_ident(self.new_name)), []
def visit_TableQueryNode(self, node):
self.write('(TABLE ')
if node.schema:
self.write(common.qname(node.schema, node.name))
else:
self.write(common.quote_ident(node.name))
self.write(')')