We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e69348b commit 9877766Copy full SHA for 9877766
ibis/expr/sql.py
@@ -465,6 +465,30 @@ def to_sql(
465
str
466
Formatted SQL string
467
468
+ Examples
469
+ --------
470
+ >>> import ibis
471
+ >>> t = ibis.table({"a": "int", "b": "int"}, name="t")
472
+ >>> expr = t.mutate(c=t.a + t.b)
473
+ >>> ibis.to_sql(expr)
474
+ SELECT
475
+ "t0"."a",
476
+ "t0"."b",
477
+ "t0"."a" + "t0"."b" AS "c"
478
+ FROM "t" AS "t0"
479
+
480
+ You can also specify the SQL dialect to use for compilation:
481
+ >>> ibis.to_sql(expr, dialect="mysql")
482
483
+ `t0`.`a`,
484
+ `t0`.`b`,
485
+ `t0`.`a` + `t0`.`b` AS `c`
486
+ FROM `t` AS `t0`
487
488
+ See Also
489
490
+ [`Table.compile()`](./expression-tables.qmd#ibis.expr.types.relations.Table.compile)
491
492
"""
493
import ibis.backends.sql.compilers as sc
494
0 commit comments