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 (95 lines) | stat: -rw-r--r-- 3,535 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Examples with Jinja2 templating.
# The input data is in input/cities.json.
# The template files are under templates.
# Several examples extending into more advanced:
# - xml: templates/cities.jinja2 simple with just for loop
# - gml: templates/gmlcities.jinja2 advanced with globals and macros
#
# All rendered output under output/
#
[etl]
chains = input_json|filter_template_xml|output_xml_file
         ,input_json|filter_template_gml|output_gml_file
         ,input_geojson|filter_template_geojson2gml|output_gml_file2
         ,input_geojson|filter_template_geojson2gml|output_std
         ,input_addresses_csv|convert_record_array_to_struct|filter_template_addresses2inspire|output_inspire_addresses

[input_json]
class = inputs.fileinput.JsonFileInput
file_path = input/cities.json

# EXAMPLE 1 - simple Jinja2 templating: JSON to XML

# Simple xml templating
[filter_template_xml]
class = filters.templatingfilter.Jinja2TemplatingFilter
template_file = templates/cities-json2xml.jinja2

[output_xml_file]
class = outputs.fileoutput.FileOutput
file_path = output/cities.xml


# EXAMPLE 2 - advanced Jinja2 templating : JSON to GML

# Advanced gml templating with globals for more or less static content
# like contact info etc
[filter_template_gml]
class = filters.templatingfilter.Jinja2TemplatingFilter
template_file = templates/cities-json2gml.jinja2
template_globals_path = input/globals.json

[output_gml_file]
class = outputs.fileoutput.FileOutput
file_path = output/cities.gml

# EXAMPLE 3 - more advanced Jinja2 templating - GeoJSON to GML - and reading from URL

[input_geojson]
class = inputs.fileinput.JsonFileInput
# file_path = input/cities-gjson.json
file_path = https://raw.githubusercontent.com/justb4/stetl/master/examples/basics/10_jinja2_templating/input/cities-gjson.json
output_format = geojson_collection

# More advanced gml templating with globals for more or less static content
# and GeoJSON to GML geometry conversion
[filter_template_geojson2gml]
class = filters.templatingfilter.Jinja2TemplatingFilter
template_file = templates/cities-gjson2gml.jinja2
template_globals_path = input/globals.json,https://raw.githubusercontent.com/justb4/stetl/master/examples/basics/10_jinja2_templating/input/more-globals.json
input_format = geojson_collection

[output_gml_file2]
class = outputs.fileoutput.FileOutput
file_path = output/cities-gjson.gml

# EXAMPLE 4 - very advanced Jinja2 templating - local addresd data (CSV) to INSPIRE Addresses (AD) GML

[input_addresses_csv]
class = inputs.fileinput.CsvFileInput
file_path = input/addresses.csv

# We need this, since the Jinja2 template expects a named struct
# So basically we will convert to a JSON-like structure where the root
# member is named "addresses" as an array of records (name/value pairs).
[convert_record_array_to_struct]
class = filters.formatconverter.FormatConverter
input_format = record_array
output_format = struct
converter_args = {'top_name' : 'addresses'}

# More advanced gml templating with globals for more or less static content
# and GeoJSON to GML geometry conversion
[filter_template_addresses2inspire]
class = filters.templatingfilter.Jinja2TemplatingFilter
template_file = templates/addresses2inspire-ad.jinja2
template_globals_path = input/addresses-globals.json

[output_inspire_addresses]
class = outputs.fileoutput.FileOutput
file_path = output/inspire-addresses.gml

# EXTRA
# for testing/debugging only: replace file output with this to directly show results
[output_std]
class = outputs.standardoutput.StandardOutput