MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/sql/compiler.py:1432–1581  ·  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

1430 cls._bind_translate_chars = cls.bindname_escape_characters
1431
1432 def __init__(
1433 self,
1434 dialect: Dialect,
1435 statement: Optional[ClauseElement],
1436 cache_key: Optional[CacheKey] = None,
1437 column_keys: Optional[Sequence[str]] = None,
1438 for_executemany: bool = False,
1439 linting: Linting = NO_LINTING,
1440 _supporting_against: Optional[SQLCompiler] = None,
1441 **kwargs: Any,
1442 ):
1443 """Construct a new :class:`.SQLCompiler` object.
1444
1445 :param dialect: :class:`.Dialect` to be used
1446
1447 :param statement: :class:`_expression.ClauseElement` to be compiled
1448
1449 :param column_keys: a list of column names to be compiled into an
1450 INSERT or UPDATE statement.
1451
1452 :param for_executemany: whether INSERT / UPDATE statements should
1453 expect that they are to be invoked in an "executemany" style,
1454 which may impact how the statement will be expected to return the
1455 values of defaults and autoincrement / sequences and similar.
1456 Depending on the backend and driver in use, support for retrieving
1457 these values may be disabled which means SQL expressions may
1458 be rendered inline, RETURNING may not be rendered, etc.
1459
1460 :param kwargs: additional keyword arguments to be consumed by the
1461 superclass.
1462
1463 """
1464 self.column_keys = column_keys
1465
1466 self.cache_key = cache_key
1467
1468 if cache_key:
1469 cksm = {b.key: b for b in cache_key[1]}
1470 ckbm = {b: [b] for b in cache_key[1]}
1471 self._cache_key_bind_match = (ckbm, cksm)
1472
1473 # compile INSERT/UPDATE defaults/sequences to expect executemany
1474 # style execution, which may mean no pre-execute of defaults,
1475 # or no RETURNING
1476 self.for_executemany = for_executemany
1477
1478 self.linting = linting
1479
1480 # a dictionary of bind parameter keys to BindParameter
1481 # instances.
1482 self.binds = {}
1483
1484 # a dictionary of BindParameter instances to "compiled" names
1485 # that are actually present in the generated SQL
1486 self.bind_names = util.column_dict()
1487
1488 # stack which keeps track of nested SELECT statements
1489 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