summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-03-30 13:06:04 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-03-30 13:06:04 +0000
commit73f7f85d9da7ebe8811d180f113714bfd8283662 (patch)
treed47758d99e82d1f773670a3986251cab5961f023 /lib/sqlalchemy/sql/compiler.py
parent7b42cb5669578cec014ece650ce3d2c6051400f0 (diff)
parenta65d5c250e9fd7090311ef12f28d7d959c6c738e (diff)
downloadsqlalchemy-73f7f85d9da7ebe8811d180f113714bfd8283662.tar.gz
Merge "Add a third labeling mode for SELECT statements"
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py22
1 files changed, 1 insertions, 21 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 000fc05fa..87ae5232e 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -40,6 +40,7 @@ from . import schema
from . import selectable
from . import sqltypes
from .base import NO_ARG
+from .base import prefix_anon_map
from .elements import quoted_name
from .. import exc
from .. import util
@@ -541,27 +542,6 @@ class _CompileLabel(elements.ColumnElement):
return self
-class prefix_anon_map(dict):
- """A map that creates new keys for missing key access.
-
- Considers keys of the form "<ident> <name>" to produce
- new symbols "<name>_<index>", where "index" is an incrementing integer
- corresponding to <name>.
-
- Inlines the approach taken by :class:`sqlalchemy.util.PopulateDict` which
- is otherwise usually used for this type of operation.
-
- """
-
- def __missing__(self, key):
- (ident, derived) = key.split(" ", 1)
- anonymous_counter = self.get(derived, 1)
- self[derived] = anonymous_counter + 1
- value = derived + "_" + str(anonymous_counter)
- self[key] = value
- return value
-
-
class SQLCompiler(Compiled):
"""Default implementation of :class:`.Compiled`.