Skip to content

Commit

Permalink
Chore: improve unsupported error documentation (#3406)
Browse files Browse the repository at this point in the history
* Chore: improve unsupported error documentation

* Wordsmith
  • Loading branch information
georgesittas committed May 4, 2024
1 parent c9d90be commit 1b5b77d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ except sqlglot.errors.ParseError as e:

### Unsupported Errors

It may not be possible to translate some queries between certain dialects. For these cases, SQLGlot may emit a warning and proceeds to do a best-effort translation by default. Transpilation is difficult and not all permutations are supported. If transpilation does not work, it may not be implemented yet. Well documented / tested PRs / issues are appreciated. Some transpilation cases that require db schemas are made possible through the optimizer but are not included in base transpilation:
It may not be possible to translate some queries between certain dialects. For these cases, SQLGlot may emit a warning and will proceed to do a best-effort translation by default:

```python
import sqlglot
Expand All @@ -262,6 +262,10 @@ sqlglot.transpile("SELECT APPROX_DISTINCT(a, 0.1) FROM foo", read="presto", writ
sqlglot.errors.UnsupportedError: APPROX_COUNT_DISTINCT does not support accuracy
```

There are queries that require additional information to be accurately transpiled, such as the schemas of the tables referenced in them. This is because certain transformations are type-sensitive, meaning that type inference is needed in order to understand their semantics. Even though the `qualify` and `annotate_types` optimizer [rules](https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer) can help with this, they are not used by default because they add significant overhead and complexity.

Transpilation is generally a hard problem, so SQLGlot employs an "incremental" approach to solving it. This means that there may be dialect pairs that currently lack support for some inputs, but this is expected to improve over time. We highly appreciate well-documented and tested issues or PRs, so feel free to [reach out](#get-in-touch) if you need guidance!

### Build and Modify SQL

SQLGlot supports incrementally building SQL expressions:
Expand Down

0 comments on commit 1b5b77d

Please sign in to comment.