Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit f9df53d

Browse files
author
Sergey Vasilyev
committed
Show debug SQL statements ready for copy-pasting
With the first line of the SQL on the first line, the file name (e.g. `base.py:123`) is copy-pasted into SQL and requirees manual editing. With this fix, the whole statement will be ready for copy-pasting without any fixes and cleanups. The statements are often multi-line anyway, so it does not damage the logging.
1 parent 747bb20 commit f9df53d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

data_diff/databases/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def apply_queries(self, callback: Callable[[str], Any]):
182182
q: Expr = next(self.gen)
183183
while True:
184184
sql = self.compiler.database.dialect.compile(self.compiler, q)
185-
logger.debug("Running SQL (%s-TL): %s", self.compiler.database.name, sql)
185+
logger.debug("Running SQL (%s-TL):\n%s", self.compiler.database.name, sql)
186186
try:
187187
try:
188188
res = callback(sql) if sql is not SKIP else SKIP
@@ -876,7 +876,7 @@ def query(self, sql_ast: Union[Expr, Generator], res_type: type = None):
876876
if sql_code is SKIP:
877877
return SKIP
878878

879-
logger.debug("Running SQL (%s): %s", self.name, sql_code)
879+
logger.debug("Running SQL (%s):\n%s", self.name, sql_code)
880880

881881
if self._interactive and isinstance(sql_ast, Select):
882882
explained_sql = self.compile(Explain(sql_ast))

0 commit comments

Comments
 (0)