Exemple #1
0
def test_pipeline_add_and_run_step():
    class TestStep(AbstractStep):
        def run(self, ctrl, log, acc):
            raise Success

    pipeline = Pipeline({})
    pipeline.add_step(TestStep('Test Step'))

    with pytest.raises(Success):
        pipeline.run()
Exemple #2
0
import psycopg2
from pipeline import Pipeline

if __name__ == '__main__':
    conn = psycopg2.connect(dbname='school_and_district',
                            password='******',
                            user='******',
                            host='localhost',
                            port='5432')

    pipeline = Pipeline(conn)

    pipeline.add_step('''
                    COPY school_and_district
                    FROM '../data/school_and_district.csv'
                    DELIMITER ','
                    CSV HEADER;
                    ''')
    pipeline.add_step('''
                        SELECT *
                        FROM school_and_district
                        LIMIT 10;
                        ''')

    pipeline.execute()
    pipeline.close()