This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Sphinx documentation and build docs as part of CI (#1861)
# Description ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The current setup for the universal transfer operator doesn't have Sphinx setup and building docs steps as part of CI <!-- Issues are required for both bug fixes and features. Reference it using one of the following: closes: #ISSUE related: #ISSUE --> closes: #1844 ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Add Sphinx documentation - Add building docs as step for CI - Add the documentation for universal transfer operator - Add various example DAGs and concepts ## Does this introduce a breaking change? No ### Checklist - [x] Created tests which fail without the change (if possible) - [x] Extended the README / documentation, if necessary --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Tatiana Al-Chueyr <tatiana.alchueyr@gmail.com> Co-authored-by: Phani Kumar <94376113+phanikumv@users.noreply.github.com>
- Loading branch information
1 parent
a6abdcf
commit 513591a
Showing
39 changed files
with
1,582 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
We as members, contributors, and leaders pledge to make participation in our | ||
community a harassment-free experience for everyone, regardless of age, body | ||
size, visible or invisible disability, ethnicity, sex characteristics, gender | ||
identity and expression, level of experience, education, socio-economic status, | ||
nationality, personal appearance, race, religion, or sexual identity | ||
and orientation. | ||
|
||
We pledge to act and interact in ways that contribute to an open, welcoming, | ||
diverse, inclusive, and healthy community. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to a positive environment for our | ||
community include: | ||
|
||
* Demonstrating empathy and kindness toward other people | ||
* Being respectful of differing opinions, viewpoints, and experiences | ||
* Giving and gracefully accepting constructive feedback | ||
* Accepting responsibility and apologizing to those affected by our mistakes, | ||
and learning from the experience | ||
* Focusing on what is best not just for us as individuals, but for the | ||
overall community | ||
|
||
Examples of unacceptable behavior include: | ||
|
||
* The use of sexualized language or imagery, and sexual attention or | ||
advances of any kind | ||
* Trolling, insulting or derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or email | ||
address, without their explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Enforcement Responsibilities | ||
|
||
Community leaders are responsible for clarifying and enforcing our standards of | ||
acceptable behavior and will take appropriate and fair corrective action in | ||
response to any behavior that they deem inappropriate, threatening, offensive, | ||
or harmful. | ||
|
||
Community leaders have the right and responsibility to remove, edit, or reject | ||
comments, commits, code, wiki edits, issues, and other contributions that are | ||
not aligned to this Code of Conduct, and will communicate reasons for moderation | ||
decisions when appropriate. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies within all community spaces, and also applies when | ||
an individual is officially representing the community in public spaces. | ||
Examples of representing our community include using an official e-mail address, | ||
posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported to the community leaders responsible for enforcement at | ||
humans@astronomer.io. | ||
All complaints will be reviewed and investigated promptly and fairly. | ||
|
||
All community leaders are obligated to respect the privacy and security of the | ||
reporter of any incident. | ||
|
||
## Enforcement Guidelines | ||
|
||
Community leaders will follow these Community Impact Guidelines in determining | ||
the consequences for any action they deem in violation of this Code of Conduct: | ||
|
||
### 1. Correction | ||
|
||
**Community Impact**: Use of inappropriate language or other behavior deemed | ||
unprofessional or unwelcome in the community. | ||
|
||
**Consequence**: A private, written warning from community leaders, providing | ||
clarity around the nature of the violation and an explanation of why the | ||
behavior was inappropriate. A public apology may be requested. | ||
|
||
### 2. Warning | ||
|
||
**Community Impact**: A violation through a single incident or series | ||
of actions. | ||
|
||
**Consequence**: A warning with consequences for continued behavior. No | ||
interaction with the people involved, including unsolicited interaction with | ||
those enforcing the Code of Conduct, for a specified period of time. This | ||
includes avoiding interactions in community spaces as well as external channels | ||
like social media. Violating these terms may lead to a temporary or | ||
permanent ban. | ||
|
||
### 3. Temporary Ban | ||
|
||
**Community Impact**: A serious violation of community standards, including | ||
sustained inappropriate behavior. | ||
|
||
**Consequence**: A temporary ban from any sort of interaction or public | ||
communication with the community for a specified period of time. No public or | ||
private interaction with the people involved, including unsolicited interaction | ||
with those enforcing the Code of Conduct, is allowed during this period. | ||
Violating these terms may lead to a permanent ban. | ||
|
||
### 4. Permanent Ban | ||
|
||
**Community Impact**: Demonstrating a pattern of violation of community | ||
standards, including sustained inappropriate behavior, harassment of an | ||
individual, or aggression toward or disparagement of classes of individuals. | ||
|
||
**Consequence**: A permanent ban from any sort of public interaction within | ||
the community. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], | ||
version 2.0, available at | ||
https://www.contributor-covenant.org/version/2/0/code_of_conduct/. | ||
|
||
Community Impact Guidelines were inspired by [Mozilla's code of conduct | ||
enforcement ladder](https://github.com/mozilla/diversity). | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see the FAQ at | ||
https://www.contributor-covenant.org/faq. Translations are available at | ||
https://www.contributor-covenant.org/translations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
|
||
Below are the Changelogs for different versions of the universal transfer operator: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= -W | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
# We don't want to download the universal_transfer_operator package every time we build docs, so this allows us to get | ||
# the version number without installing universal_transfer_operator | ||
__version__ = None | ||
with open("../src/universal_transfer_operator/__init__.py") as f: | ||
while not __version__: | ||
current_line = f.readline() | ||
if "__version__" in current_line: | ||
__version__ = current_line.split(" ")[-1] | ||
|
||
project = "universal-transfer-operator" | ||
copyright = "2022, Astronomer inc." # noqa | ||
author = "Astronomer inc." | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = __version__ | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx", "autoapi.extension", "myst_parser"] | ||
autodoc_typehints = "description" | ||
|
||
myst_all_links_external = True | ||
autoapi_keep_files = True | ||
autoapi_type = "python" | ||
autoapi_template_dir = "_autoapi_template" | ||
autoapi_dirs = ["../src"] | ||
autoapi_options = [ | ||
"members", | ||
"undoc-members", | ||
"show-inheritance", | ||
"show-module-summary", | ||
] | ||
|
||
suppress_warnings = [ | ||
"autoapi.python_import_resolution", | ||
] | ||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ["_autoapi_templates"] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "*.txt"] | ||
|
||
# Mapping to inter-sphinx linking. | ||
intersphinx_mapping = { | ||
"airflow": ("https://airflow.apache.org/docs/apache-airflow/stable", None), | ||
"airflow-postgres": ("https://airflow.apache.org/docs/apache-airflow-providers-postgres/stable", None), | ||
} | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "sphinx_rtd_theme" | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
# html_static_path = ["_static"] | ||
|
||
source_suffix = { | ||
".rst": "restructuredtext", | ||
".txt": "markdown", | ||
".md": "markdown", | ||
} | ||
|
||
|
||
# TODO: We should consider removing param start _ | ||
def skip_util_classes(_app, _what, _name, obj, skip, _options): | ||
"""This allows us skipping certain objects (including functions & methods) from docs""" | ||
if ":sphinx-autoapi-skip:" in obj.docstring: | ||
skip = True | ||
return skip | ||
|
||
|
||
def setup(sphinx): | ||
sphinx.connect("autoapi-skip-member", skip_util_classes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Configuration | ||
============= | ||
|
||
Configuring the database default schema | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
The Universal Transfer Operator uses the global default schema configuration for the ``Table`` metadata, unless users | ||
specify a different specific ``Table`` (metadata) ``schema``. | ||
|
||
User can define the default schema in two ways: | ||
1. Globally, for all the databases | ||
2. Individually, for each database | ||
|
||
The Universal transfer operator applies the global default schema (``tmp_transfers`` by default) when the user does not | ||
set up a database-specific configuration. Example: | ||
environment variable : | ||
|
||
.. code:: ini | ||
AIRFLOW__UNIVERSAL_TRANSFER_OPERATOR__SQL_SCHEMA="tmp_transfers" | ||
or by updating Airflow's configuration | ||
|
||
.. code:: ini | ||
[universal_transfer_operator] | ||
schema = "tmp_transfers" | ||
We can set up the default schema for each database type, such as Snowflake, BigQuery, or Postgres. The database-specific schema overrides the global default schema if both are defined. | ||
|
||
.. code:: ini | ||
[universal_transfer_operator] | ||
AIRFLOW__UNIVERSAL_TRANSFER_OPERATOR__POSTGRES_DEFAULT_SCHEMA = "postgres_tmp" | ||
AIRFLOW__UNIVERSAL_TRANSFER_OPERATOR__BIGQUERY_DEFAULT_SCHEMA = "bigquery_tmp" | ||
AIRFLOW__UNIVERSAL_TRANSFER_OPERATOR__SNOWFLAKE_DEFAULT_SCHEMA = "snowflake_tmp" | ||
AIRFLOW__UNIVERSAL_TRANSFER_OPERATOR__REDSHIFT_DEFAULT_SCHEMA = "redshift_tmp" | ||
AIRFLOW__UNIVERSAL_TRANSFER_OPERATOR__MSSQL_DEFAULT_SCHEMA = "mssql_tmp" | ||
or by updating Airflow's configuration | ||
|
||
.. code:: ini | ||
[universal_transfer_operator] | ||
postgres_default_schema = "postgres_tmp" | ||
bigquery_default_schema = "bigquery_tmp" | ||
snowflake_default_schema = "snowflake_tmp" | ||
redshift_default_schema = "redshift_tmp" | ||
mssql_default_schema = "mssql_tmp" |
Oops, something went wrong.