Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ADR document describing why the notion of dialects was introduced in the common sql provider #45456

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

dabla
Copy link
Contributor

@dabla dabla commented Jan 7, 2025

Added ADR document describing why the notion of dialects was introduced in the common sql provider.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

…ects was introduced in the common sql provider
@dabla
Copy link
Contributor Author

dabla commented Jan 7, 2025

@potiuk @jscheffl As promised a document describing the dialects in common sql provider. If any remarks or improvements are necessary please let me know.

@eladkal
Copy link
Contributor

eladkal commented Jan 7, 2025

NIce! I think we are also missing user facing docs about what dialects are and how to use them (ADR is for Airflow developers to document our design choices but it's not really a user facing doc)

@dabla
Copy link
Contributor Author

dabla commented Jan 7, 2025

NIce! I think we are also missing user facing docs about what dialects are and how to use them (ADR is for Airflow developers to document our design choices but it's not really a user facing doc)

Where should I put those user facing docs? Is that under docs/apache-airflow-providers-common-sql? Should I create a new dialects.rst document?

@eladkal
Copy link
Contributor

eladkal commented Jan 7, 2025

Where should I put those user facing docs? Is that under docs/apache-airflow-providers-common-sql? Should I create a new dialects.rst document?

Yes. You dont have to create new .rst
Depends on the scope of what you write. If its 1-2 pargraphs it might fit in the current rst we have.
However you may want to mention in the providers we have dedicated dialect how to use it and link to the doc in common.sql so there may be need for doc changea in several providers

@eladkal
Copy link
Contributor

eladkal commented Jan 10, 2025

@dabla do you intend to add the docs in this PR?

@dabla
Copy link
Contributor Author

dabla commented Jan 10, 2025

@dabla do you intend to add the docs in this PR?

I just committed a new dialects.rst and adapted the index.rst this morning, what do you think about it?

Comment on lines +42 to +53
At the moment there are only 3 dialects available:

- ``default`` :class:`~airflow.providers.common.sql.dialects.dialect.Dialect` reuses the generic functionality that was already available in the :class:`~airflow.providers.common.sql.hooks.sql.DbApiHook`;
- ``mssql`` :class:`~airflow.providers.microsoft.mssql.dialects.mssql.MsSqlDialect` specialized for Microsoft SQL Server;
- ``postgresql`` :class:`~airflow.providers.postgres.dialects.postgres.PostgresDialect` specialized for PostgreSQL;

The dialect to be used will be derived from the connection string, which sometimes won't be possible. There is always
the possibility to specify the dialect name through the extra options of the connection:

.. code-block::

dialect_name: 'mssql'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice!
I think we better also have dialects.rst in the docs of mssql and postgres and reference the guide from here.
Some users may land directly in the relevant docs rather than in the common.sql doc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look at it shortly. Been kinda busy with refactors and stuff :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dabla can you add dialects.rst also in mysql and postgres providers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dabla can you add dialects.rst also in mysql and postgres providers?

I've added the reference to dialects in both indexes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this can pass the doc build... i think you have to create a separate doc for each one but if the doc build passes I am fine with it

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, "late to the party" now digging through my backlog... wanted to review earlier.

I really like this and the description.

For the docs build problem I see two options: (1) [not sure if this really works] outside the TOC create a small RST just with the heading and pointing to the other doctree - or (2) if you want to have exactly the same doc in each provider then use a symlink in GIT such that the RST is maintained in one place and each doctree has the same. (As long as we not move the providers the symlink is working in Sphinx)

Can you add some example the the dialects.rst or is this already contained in the implementation PR?

@dabla
Copy link
Contributor Author

dabla commented Jan 15, 2025

Sorry, "late to the party" now digging through my backlog... wanted to review earlier.

I really like this and the description.

For the docs build problem I see two options: (1) [not sure if this really works] outside the TOC create a small RST just with the heading and pointing to the other doctree - or (2) if you want to have exactly the same doc in each provider then use a symlink in GIT such that the RST is maintained in one place and each doctree has the same. (As long as we not move the providers the symlink is working in Sphinx)

Can you add some example the the dialects.rst or is this already contained in the implementation PR?

Will look into it. I also opened another PR related to this which fixes an issue with reserved words and special characters using the dialects.

@dabla
Copy link
Contributor Author

dabla commented Jan 15, 2025

Sorry, "late to the party" now digging through my backlog... wanted to review earlier.

I really like this and the description.

For the docs build problem I see two options: (1) [not sure if this really works] outside the TOC create a small RST just with the heading and pointing to the other doctree - or (2) if you want to have exactly the same doc in each provider then use a symlink in GIT such that the RST is maintained in one place and each doctree has the same. (As long as we not move the providers the symlink is working in Sphinx)

Can you add some example the the dialects.rst or is this already contained in the implementation PR?

Not that found of symlinks, dunno how git will handle those. Aren't http references an option? I saw it's also used within rst.

For example (won't exist atm ofc):

https://airflow.apache.org/docs/apache-airflow-providers-common-sql/stable/dialects.html

@dabla dabla requested a review from jscheffl January 15, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants