GithubHelp home page GithubHelp logo

dts's Introduction

dts: Generate sequence of datetimes, like seq

Sequece of dates

dts generate sequence of datetimes.

$ dts 20180401 20180403
20180401
20180402
20180403

If you do it using seq, it will like below.

$ seq 1 3
1
2
3
$ seq -f '%02g' 1 3 | xargs -I {} echo "201804{}"
20180401
20180402
20180403

Install

pip install dts

How to use: Simple

$ dts -h
usage: dts [-h] [-i INTERVAL] [-f FORMAT] FIRST LAST

dts is a seq util for datetimes

Examples:

  $ dts 20180501 20180503
  20180501
  20180502
  20180503

  $ dts 20180501-0900 20180501-1200 -i h1 -f '%Y-%m-%dT%H:%M:%S'
  2018-05-01T09:00:00
  2018-05-01T10:00:00
  2018-05-01T11:00:00
  2018-05-01T12:00:00

Github: https://github.com/KwangYeol/dts

positional arguments:
  FIRST                 first date of the seq. For example, 2018-05-01, 20180501, 20180501-0900, 2018-05-01T09:00
  LAST                  last date of the seq. See also, FIRST

optional arguments:
  -h, --help            show this help message and exit
  -i INTERVAL, --interval INTERVAL
                        interval: h1, d1, w1. default value is d1
  -f FORMAT, --format FORMAT
                        see also, datetime.strftime

How to use: with Pipeline

$ dts 20180401 20180430 -i d7
20180401
20180408
20180415
20180422
20180429

$ dts 20180510-0900 20180510-1400 -i h1 -f '%Y%m%d-%H00'
20180510-0900
20180510-1000
20180510-1100
20180510-1200
20180510-1300
20180510-1400

$ dts 20180510-0900 20180510-1400 -i h1 -f '%Y-%m-%dT%H:00'
2018-05-10T09:00
2018-05-10T10:00
2018-05-10T11:00
2018-05-10T12:00
2018-05-10T13:00
2018-05-10T14:00

How to use

For examle, you have hive table named credit which has daily partition yyyymmdd like below.

hadoop fs -ls /hive/warehouse/sales.db/credit/yyyymmdd=20180401

You can find the data size in some range with dts.

$ dts 20180401 20180410 | xargs -I {} hadoop fs -ls /hive/warehouse/sales.db/credit/yyyymmdd={}

Development

python setup.py install python setup.py sdist python setup.py sdist bdist bdist_wheel

dts's People

Contributors

kwangyeol avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.