MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/sql/compiler.py:1373–1517  ·  view source on GitHub ↗

Construct a new :class:`.SQLCompiler` object. :param dialect: :class:`.Dialect` to be used :param statement: :class:`_expression.ClauseElement` to be compiled :param column_keys: a list of column names to be compiled into an INSERT or UPDATE statement. :

(
        self,
        dialect: Dialect,
        statement: Optional[ClauseElement],
        cache_key: Optional[CacheKey] = None,
        column_keys: Optional[Sequence[str]] = None,
        for_executemany: bool = False,
        linting: Linting = NO_LINTING,
        _supporting_against: Optional[SQLCompiler] = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

1371 cls._bind_translate_chars = cls.bindname_escape_characters
1372
1373 def __init__(
1374 self,
1375 dialect: Dialect,
1376 statement: Optional[ClauseElement],
1377 cache_key: Optional[CacheKey] = None,
1378 column_keys: Optional[Sequence[str]] = None,
1379 for_executemany: bool = False,
1380 linting: Linting = NO_LINTING,
1381 _supporting_against: Optional[SQLCompiler] = None,
1382 **kwargs: Any,
1383 ):
1384 """Construct a new :class:`.SQLCompiler` object.
1385
1386 :param dialect: :class:`.Dialect` to be used
1387
1388 :param statement: :class:`_expression.ClauseElement` to be compiled
1389
1390 :param column_keys: a list of column names to be compiled into an
1391 INSERT or UPDATE statement.
1392
1393 :param for_executemany: whether INSERT / UPDATE statements should
1394 expect that they are to be invoked in an "executemany" style,
1395 which may impact how the statement will be expected to return the
1396 values of defaults and autoincrement / sequences and similar.
1397 Depending on the backend and driver in use, support for retrieving
1398 these values may be disabled which means SQL expressions may
1399 be rendered inline, RETURNING may not be rendered, etc.
1400
1401 :param kwargs: additional keyword arguments to be consumed by the
1402 superclass.
1403
1404 """
1405 self.column_keys = column_keys
1406
1407 self.cache_key = cache_key
1408
1409 if cache_key:
1410 cksm = {b.key: b for b in cache_key[1]}
1411 ckbm = {b: [b] for b in cache_key[1]}
1412 self._cache_key_bind_match = (ckbm, cksm)
1413
1414 # compile INSERT/UPDATE defaults/sequences to expect executemany
1415 # style execution, which may mean no pre-execute of defaults,
1416 # or no RETURNING
1417 self.for_executemany = for_executemany
1418
1419 self.linting = linting
1420
1421 # a dictionary of bind parameter keys to BindParameter
1422 # instances.
1423 self.binds = {}
1424
1425 # a dictionary of BindParameter instances to "compiled" names
1426 # that are actually present in the generated SQL
1427 self.bind_names = util.column_dict()
1428
1429 # stack which keeps track of nested SELECT statements
1430 self.stack = []

Callers

nothing calls this directly

Calls 9

_process_numericMethod · 0.95
_process_positionalMethod · 0.95
construct_paramsMethod · 0.95
prefix_anon_mapClass · 0.85
startswithMethod · 0.45
__init__Method · 0.45
updateMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected