GitHub user dosubot[bot] added a comment to the discussion: Superset + 
Opensearch integration

<!-- Answer -->
To add Opensearch dialect support in Superset, you’ll need to:

1. Implement or extend an EngineSpec subclass for Opensearch in 
`superset/db_engine_specs/`. Use classes like `PrestoEngineSpec` or 
`PostgresEngineSpec` as templates—define engine name, aliases, driver mappings, 
column type mappings, and SQL generation logic. Pay special attention to 
identifier quoting and SQL syntax that Opensearch expects 
[[example](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/postgres.py)].

2. Ensure there is a corresponding sqlglot dialect for Opensearch. If one 
doesn’t exist, you may need to contribute it upstream to sqlglot or implement 
it locally. This is crucial for correct SQL parsing and formatting, especially 
for identifier quoting (avoid backticks, use double quotes or none as required 
by Opensearch) 
[[reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py)].

3. Register the new dialect in the `SQLGLOT_DIALECTS` mapping so Superset uses 
it for parsing and formatting queries for Opensearch connections. If you need 
to extend or override dialect behavior, use the `SQLGLOT_DIALECTS_EXTENSIONS` 
config 
[[reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/config.py)].

4. If you want to distribute the dialect as a plugin, use Superset’s plugin 
architecture based on Python entry points. This allows you to install new 
EngineSpecs without modifying the core codebase 
[[reference](https://github.com/apache/superset/issues/31932)].

5. Add unit and integration tests for your EngineSpec, covering query parsing, 
dataset creation, and error handling. Manually verify that the UI works as 
expected with Opensearch.

6. Update documentation for users and contributors, including connection 
instructions, limitations, and any custom configuration.

If Opensearch support is missing in SQLAlchemy or sqlglot, you may need to 
contribute dialects upstream or adapt existing ones. For more on contributing, 
see Superset’s [contribution 
guidelines](https://superset.apache.org/docs/contributing/contribution-guidelines).

Let me know if you want pointers to specific code examples or have questions 
about any of these steps.


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/78a1f4d3-1867-4594-9423-2060ad9a5539?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/78a1f4d3-1867-4594-9423-2060ad9a5539?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/78a1f4d3-1867-4594-9423-2060ad9a5539?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/78a1f4d3-1867-4594-9423-2060ad9a5539?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/78a1f4d3-1867-4594-9423-2060ad9a5539?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/78a1f4d3-1867-4594-9423-2060ad9a5539?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/78a1f4d3-1867-4594-9423-2060ad9a5539?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Sh
 are on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34083)

GitHub link: 
https://github.com/apache/superset/discussions/34083#discussioncomment-13681016

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to