Skip to content

Conversation

@zula-baldez
Copy link

@zula-baldez zula-baldez commented Dec 23, 2025

Implementation of YDB dialect for SQLGlot. This PR focuses on adding the YDB SQL dialect generator to support YDB-specific SQL syntax and features.

YDB documentation: https://ydb.tech/

@zula-baldez zula-baldez changed the title YDB Dialect implementation feat(YDB): implemented ydb dialect Dec 23, 2025
@zula-baldez zula-baldez changed the title feat(YDB): implemented ydb dialect feat(ydb): implemented ydb dialect Dec 23, 2025
@georgesittas
Copy link
Collaborator

Thanks for the PR, but there are no plans to accept new dialects at the moment.

@vgvoleg
Copy link
Contributor

vgvoleg commented Dec 23, 2025

Thanks for the PR, but there are no plans to accept new dialects at the moment.

Hi @georgesittas! Any details about this limitation? YDB team would like to support this community dialect.

@georgesittas
Copy link
Collaborator

Maintaining dialects imposes a significant burden on the core SQLGlot team: even if features are contributed by community members, we still have to review everything which is time-consuming & cannot be prioritized at the moment.

It should be simple to define this dialect in your application.

@vgvoleg
Copy link
Contributor

vgvoleg commented Dec 23, 2025

Maintaining dialects imposes a significant burden on the core SQLGlot team: even if features are contributed by community members, we still have to review everything which is time-consuming & cannot be prioritized at the moment.

It should be simple to define this dialect in your application.

We are focused on integrations with some instruments, that rely on sqlglot. Do you have some examples how to integrate with sqlglot in a plugin-like way?

@georgesittas
Copy link
Collaborator

@vgvoleg
Copy link
Contributor

vgvoleg commented Dec 23, 2025

Check out https://github.com/TobikoData/sqlmesh/blob/main/sqlmesh/core/dialect.py and https://github.com/TobikoData/sqlmesh/blob/main/sqlmesh/__init__.py#L19.

Seems like we still have to "extend" sqlglot on every target app. What do you think about not limiting dialect list with DIALECTS dict? We are happy to create a plugin package with sqlglot.dialects.ydb module, but it will not work with just pip install ydb-sqlglot-plugin :(

@georgesittas
Copy link
Collaborator

You could create a package that extends it once and then import it in other apps that need to leverage the dialect, no?

@georgesittas
Copy link
Collaborator

Btw, dialects get auto-registered once defined. So you just need to make sure the package where they defined is imported as early as possible so that other sqlglot imports "see" the dialect.

@vgvoleg
Copy link
Contributor

vgvoleg commented Dec 23, 2025

Btw, dialects get auto-registered once defined. So you just need to make sure the package where they defined is imported as early as possible so that other sqlglot imports "see" the dialect.

Yes, but monkey-patching dialect list with import plugin-package does not feel like a "true" plugin

As I see https://github.com/tobymao/sqlglot/blob/main/sqlglot/dialects/__init__.py#L119

def __getattr__(name):
    module_name = MODULE_BY_ATTRIBUTE.get(name)
    if module_name:
        with _import_lock:
            module = importlib.import_module(f"sqlglot.dialects.{module_name}")
        return getattr(module, name)

    raise AttributeError(f"module {__name__} has no attribute {name}")

we are not able to import dialect that is not defined in DIALECTS dict.

yes, we can extend it in plugin init file, but

import sqlglot_plugin # noqa: we need to import this module to enable integration

just don't feel right

@georgesittas
Copy link
Collaborator

Makes sense. I think what you described in the relevant issue would make the "plugin flow" better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants