MCPcopy Index your code
hub / github.com/tobymao/sqlglot / test_identifier

Method test_identifier

tests/test_diff.py:270–293  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

268 )
269
270 def test_identifier(self):
271 expr_src = parse_one("SELECT a FROM tbl")
272 expr_tgt = parse_one("SELECT a, tbl.b from tbl")
273
274 self._validate_delta_only(
275 diff_delta_only(expr_src, expr_tgt),
276 [
277 Insert(expression=exp.to_column("tbl.b")),
278 ],
279 )
280
281 expr_src = parse_one("SELECT 1 AS c1, 2 AS c2")
282 expr_tgt = parse_one("SELECT 2 AS c1, 3 AS c2")
283
284 self._validate_delta_only(
285 diff_delta_only(expr_src, expr_tgt),
286 [
287 Remove(expression=exp.alias_(1, "c1")),
288 Remove(expression=exp.Literal.number(1)),
289 Insert(expression=exp.alias_(3, "c2")),
290 Insert(expression=exp.Literal.number(3)),
291 Update(source=exp.alias_(2, "c2"), target=exp.alias_(2, "c1")),
292 ],
293 )
294
295 def test_dialect_aware_diff(self):
296 from sqlglot.generator import logger

Callers

nothing calls this directly

Calls 8

_validate_delta_onlyMethod · 0.95
parse_oneFunction · 0.90
InsertClass · 0.90
RemoveClass · 0.90
UpdateClass · 0.90
diff_delta_onlyFunction · 0.85
to_columnMethod · 0.80
numberMethod · 0.45

Tested by

no test coverage detected