コード例 #1
0
def validate_args(args):
    if not args.inst:
        tools.abort("Error: instance not provided as arg or env var")
    if not args.db:
        tools.abort("Error: database not provided as arg or env var")
    if not args.table:
        tools.abort("Error: table not provided as arg or env var")
    if args.mode not in ('incremental', 'full', 'auto'):
        tools.abort("Error: mode value is invalid: %s" % args.mode)

    if args.data_start_ts_prior and not tools.valid_iso8601(args.data_start_ts_prior, 'basic'):
        tools.abort("Error: invalid timestamp: %s" % args.data_start_ts_prior)
    if args.data_stop_ts_prior and not tools.valid_iso8601(args.data_stop_ts_prior, 'basic'):
        tools.abort("Error: invalid timestamp: %s" % args.data_stop_ts_prior)

    return args
コード例 #2
0
def validate_args(args):

    if not args.inst:
        abort("Error: instance not provided as arg or env var")
    if not args.db:
        abort("Error: database not provided as arg or env var")
    if not args.child_table:
        abort("Error: child_table not provided as arg or env var")
    if not args.child_col:
        abort("Error: child_col not provided as arg or env var")
    if not args.parent_table:
        abort("Error: parent_table not provided as arg or env var")
    if not args.parent_col:
        abort("Error: parent_col not provided as arg or env var")
    if args.start_ts and not tools.valid_iso8601(args.start_ts, 'basic'):
        abort("Error: start_ts is invalid: %s" % args.start_ts)
    if args.stop_ts and not tools.valid_iso8601(args.stop_ts, 'basic'):
        abort("Error: stop_ts is invalid: %s" % args.stop_ts)
コード例 #3
0
 def test_invalid_misc(self):
     assert mod.valid_iso8601('20160102T030405', 'ext') is False
     assert mod.valid_iso8601(None, 'ext') is False
コード例 #4
0
 def test_invalid_long(self):
     assert mod.valid_iso8601('2016-01-02T03-04-05-123456', 'ext') is False
コード例 #5
0
 def test_invalid_short(self):
     assert mod.valid_iso8601('2016:01:02T03:04:05', 'ext') is False
コード例 #6
0
 def test_valid_long(self):
     assert mod.valid_iso8601('2016-01-02T03:04:05.123456', 'ext') is True
コード例 #7
0
 def test_valid_short(self):
     assert mod.valid_iso8601('2016-01-02T03:04:05', 'ext') is True
コード例 #8
0
 def test_invalid_long(self):
     assert mod.valid_iso8601('20160102 030405123456', 'basic') is False
コード例 #9
0
 def test_invalid_short(self):
     assert mod.valid_iso8601('20160102 030405', 'basic') is False
コード例 #10
0
 def test_valid_long(self):
     assert mod.valid_iso8601('20160102T030405123456', 'basic') is True
コード例 #11
0
 def test_valid_short(self):
     assert mod.valid_iso8601('20160102T030405', 'basic') is True