<commit_before>Using SQLAlchemy in Luigi Workflow Pipeline
###########################################

:date: 2014-12-31
:tags: Programming, Python, Luigi, SQLAlchemy
:slug: building-luigi-task-pipeline
:author: <NAME>
:description: This is a very basic example on using Luigi sqla contrib module in a task pipeline while using luigi
:keywords: Python, Programming, Luigi, Task Pipeline, SQLAlchemy, sqla 

The ``luigi.contrib.sqla`` provides support for SQLAlchmey through the ``SQLAlchemyTarget`` 
for storing in databases supported by SQLAlchemy. The user would be responsible for 
installing the required database driver to connect using ``SQLAlchemy``.

Minimal example of a job to copy data to database using ``SQLAlchemy`` is as shown
below:

.. code-block:: python

    from sqlalchemy import String
    import luigi
    from luigi.contrib import sqla

    class SQLATask(sqla.CopyToTable):
        # columns defines the table schema, with each element corresponding
        # to a column in the format (args, kwargs) which will be sent to<commit_msg>Update sqla-luigi-workflow.rst<commit_after>Using SQLAlchemy in Luigi Workflow Pipeline
###########################################

:date: 2014-12-31
:tags: Programming, Python, Luigi, SQLAlchemy
:slug: sqlalchemy-luigi-workflow-pipeline
:author: <NAME>
:description: This is a very basic example on using Luigi sqla contrib module in a task pipeline while using luigi
:keywords: Python, Programming, Luigi, Task Pipeline, SQLAlchemy, sqla 

The ``luigi.contrib.sqla`` provides support for SQLAlchmey through the ``SQLAlchemyTarget`` 
for storing in databases supported by SQLAlchemy. The user would be responsible for 
installing the required database driver to connect using ``SQLAlchemy``.

Minimal example of a job to copy data to database using ``SQLAlchemy`` is as shown
below:

.. code-block:: python

    from sqlalchemy import String
    import luigi
    from luigi.contrib import sqla

    class SQLATask(sqla.CopyToTable):
        # columns defines the table schema, with each element corresponding
        # to a column in the format (args, kwargs) which will be sent to
{'fraction_non_alphanumeric': 0.10405972935137657, 'fraction_numerical': 0.007466168922071862, 'mean_word_length': 4.687002652519894, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5615624', 'n_tokens_mistral': 622, 'n_tokens_neox': 575, 'n_words': 256}