Skip to content

Commit

Permalink
docs: startup docs (#3)
Browse files Browse the repository at this point in the history
* fix: readthedocs build failed

* docs: a startup README

* docs: startup docs
  • Loading branch information
reata committed Jul 26, 2019
1 parent 8dd7b6c commit b79a09a
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 20 deletions.
19 changes: 19 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.6
install:
- requirements: docs/requirements.txt
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sqllineage
# SQLLineage
SQL Lineage Analysis Tool powered by Python

[![image](https://img.shields.io/pypi/v/sqllineage.svg)](https://pypi.org/project/sqllineage/)
Expand All @@ -9,4 +9,36 @@ SQL Lineage Analysis Tool powered by Python
[![Documentation Status](https://readthedocs.org/projects/sqllineage/badge/?version=latest)](https://sqllineage.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/reata/sqllineage/branch/master/graph/badge.svg)](https://codecov.io/gh/reata/sqllineage)

This project is still in Alpha stage. Interfaces are supposed to change in upcoming development cycles.
Never get the hang of a SQL parser? SQLLineage comes to the rescue. Given a SQL command, SQLLineage will tell you its
source and target tables, without worrying about Tokens, Keyword, Identifier and all the jagons used by SQL parsers.

Behind the scene, SQLLineage uses the fantastic [`sqlparse`](https://github.com/andialbrecht/sqlparse) library to parse
the SQL command, and bring you all the human-readable result with ease.


## Quick Start
Install sqllineage via PyPI:
```bash
$ pip install sqllineage
```

Using sqllineage command to parse a quoted-query-string:
```
$ sqllineage -e "insert into table1 select * from table2"
Statements(#): 1
Source Tables:
table2
Target Tables:
table1
```

Or you can parse a SQL file with -f option:
```
$ sqllineage -f foo.sqlStatements(#): 1
Statements(#): 1
Source Tables:
table_foo
table_bar
Target Tables:
table_baz
```
30 changes: 30 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
*********
Changelog
*********

v0.1.0
======

:Date: July 26, 2019

New Features
-------------
* stable command line interface (`#2 <https://github.com/reata/sqllineage/issues/2>`_)

Enhancement
-------------
* combine setup.py and requirements.txt (`#6 <https://github.com/reata/sqllineage/issues/6>`_)
* combine tox and Travis CI (`#5 <https://github.com/reata/sqllineage/issues/5>`_)
* table-wise lineage with sufficient test cases (`#4 <https://github.com/reata/sqllineage/issues/4>`_)
* a startup docs for sqllineage's usage (`#3 <https://github.com/reata/sqllineage/issues/3>`_)
* pypi badges in README (`#1 <https://github.com/reata/sqllineage/issues/1>`_)

v0.0.1
======

:Date: June 16, 2019

New Features
-------------
initial public release

15 changes: 10 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@


# -- Project information -----------------------------------------------------
import os
import sys

project = 'sqllineage'
copyright = '2019, Reata' # noqa
sys.path.insert(0, os.path.abspath(".."))

from sqllineage import name, version # noqa

project = name
copyright = '2019, Reata' # noqa
author = 'Reata'

# The full version, including alpha/beta/rc tags
release = '0.0.1'

release = version

# -- General configuration ---------------------------------------------------

Expand All @@ -47,7 +52,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
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,
Expand Down
41 changes: 41 additions & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
***************
Getting Started
***************

Install via PyPI
==================

Install the package (or add it to your ``requirements.txt`` file):

.. code-block:: bash
pip install sqllineage
SQLLineage in Command Line
=======================================

After installation, you will get a `sqllineage` command. It has two options:

- -e option let you pass a quoted query string as SQL command
- -f option let you pass a file that contains a or more SQL commands

.. code-block:: bash
$ sqllineage -e "insert into table1 select * from table2"
Statements(#): 1
Source Tables:
table2
Target Tables:
table1
.. code-block:: bash
$ sqllineage -f foo.sql
Statements(#): 1
Source Tables:
table_foo
table_bar
Target Tables:
table_baz
28 changes: 16 additions & 12 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
.. sqllineage documentation master file, created by
sphinx-quickstart on Wed May 22 22:48:13 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
SQLLineage: SQL Lineage Analysis Tool Powered by Python
=======================================================

Never get the hang of a SQL parser? SQLLineage comes to the rescue. Given a SQL command, SQLLineage will tell you its
source and target tables, without worrying about Tokens, Keyword, Identified and all the jagons used by a SQL parser.

Behind the scene, SQLLineage uses the fantastic sqlparse library to parse the SQL command, and bring you all the
human-readable result with ease.

Welcome to sqllineage's documentation!
======================================

.. toctree::
:maxdepth: 2
:caption: Contents:
:hidden:
:caption: First steps

getting_started


Indices and tables
==================
.. toctree::
:maxdepth: 2
:hidden:
:caption: Changelog

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
changelog
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sphinx>=2.1.0,<2.2.0
sphinx_rtd_theme>=0.4.0,<0.5.0
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"flake8-logging-format",
"pytest>=4.5.0,<5.0",
"pytest-cov",
"sphinx>=2.0.0",
"tox>=3.11.0,<4.0",
"twine",
"wheel"
Expand Down

0 comments on commit b79a09a

Please sign in to comment.