File: etl.cfg

package info (click to toggle)
python-stetl 1.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 89,988 kB
  • sloc: python: 5,007; xml: 707; sql: 430; makefile: 155; sh: 50
file content (59 lines) | stat: -rw-r--r-- 1,410 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Transform all records of input sqlite table to json file

[etl]
chains = input_sqlite_all|convert_records_to_json|output_cities_file,
         input_sqlite_single|convert_record_to_json|output_city_file

#
# CHAIN 1 - Multi Record case
#

# Read all records from SQLite DB into record array
[input_sqlite_all]
class = inputs.dbinput.SqliteDbInput
output_format = record_array
database_name = input/cities.sdb
table = cities
read_once = True
query = select * from cities

# Use the standard converter to convert record array to struct (dict)
[convert_records_to_json]
class = filters.formatconverter.FormatConverter
input_format = record_array
output_format = struct
converter_args = {
    'top_name': 'cities'
    }

[output_cities_file]
class = outputs.fileoutput.FileOutput
file_path = output/cities.json

#
# CHAIN 2 - Single Record case
#

# Read single record from SQLite DB into record
[input_sqlite_single]
class = inputs.dbinput.SqliteDbInput
output_format = record
database_name = input/cities.sdb
table = cities
read_once = True
query = select * from cities where name = 'Rome'

# Use the standard converter to convert record to struct (dict)
[convert_record_to_json]
class = filters.formatconverter.FormatConverter
input_format = record
output_format = struct
converter_args = {
    'top_name': 'city'
    }

[output_city_file]
class = outputs.fileoutput.FileOutput
file_path = output/city.json