Example #1
0
def test_guess_schema():
    for department in ('engineering', 'sales', 'marketing'):
        sub_path = os.path.join(path, department)
        os.mkdir(sub_path)
        with open(os.path.join(sub_path, 'data.csv'), 'w') as f:
            f.write('column1, column2, column3\n')
            for x in range(1000):
                f.write('a, "b", 1\n')

    adapter = DirAdapter(
        employees=dict(root_dir=path, pattern="{department}", decode="auto"))

    schema = adapter.schema('employees')