Debian Codegraph @

django_cte/_quoting.py

raw
1 import django
2
3 # `SQLCompiler.quote_name()` was added in Django 6.1, deprecating
4 # `quote_name_unless_alias()`, which did not quote table aliases. Use
5 # whichever one Django itself uses so generated SQL agrees on how aliases
6 # are spelled. Can be removed when the oldest supported Django is 6.1.
7 _QUOTE_NAME = (
8 "quote_name" if django.VERSION >= (6, 1) else "quote_name_unless_alias"
9 )
10
11
12 def quote_name(compiler):
13 """Get the compiler's name quoting function"""
14 return getattr(compiler, _QUOTE_NAME)