File: stetl

package info (click to toggle)
python-stetl 2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 90,156 kB
  • sloc: python: 5,103; xml: 707; sql: 430; makefile: 154; sh: 65
file content (43 lines) | stat: -rwxr-xr-x 1,210 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
#!/usr/bin/env python
# Main Stetl program.
#
# Author: Just van den Broecke
#
from stetl.main import parse_args
from stetl.etl import ETL
from stetl.util import Util
from stetl.version import __version__
import sys

log = Util.get_log('main')


def main():
    """The Stetl `main` program, to be called from commandline, like `stetl -c etl.cfg`.

    Args:
       -c  --config <config_file>  the Stetl config file.
       -s  --section <section_name> the section in the Stetl config (ini) file to execute (default is [etl]).
       -a  --args <arglist> zero or more substitutable args for symbolic, {arg}, values in Stetl config file, in format -a arg1=foo -a arg2=bar etc.
       -v  --version Show the current version of stelt and exit
       -h  --help <subject> Get component documentation like its configuration parameters, e.g. stetl doc stetl.inputs.fileinput.FileInput

    """

    args = parse_args(sys.argv[1:])

    if args.version:
        print('Stetl version: ', __version__)
        exit()

    if args.config_file:
        # Do the ETL
        etl = ETL(vars(args), args.config_args)
        etl.run()

    else:
        print('Try stetl -h for help')


if __name__ == "__main__":
    main()