Skip to content

Instantly share code, notes, and snippets.

@stefanooldeman
Last active August 29, 2015 14:05
Show Gist options
  • Save stefanooldeman/b977501a3f2dde8d6afe to your computer and use it in GitHub Desktop.
Save stefanooldeman/b977501a3f2dde8d6afe to your computer and use it in GitHub Desktop.
generate partitions (manual patch)
days = range(16,30) # the days of the month=
p = "ALTER TABLE set_videoads_valid ADD IF NOT EXISTS PARTITION (year={year:d}, month={month:d}, day={day:d}, hour={hour:d}) LOCATION 'hdfs://spil-hadoop/datain/set/portal/valid/year={year:04d}/month={month:02d}/day={day:02d}/hour={hour:02d}'; "
print "USE datain; "
for x in days:
for h in range(0,24):
print p.format(year=2014, month=7, day=x, hour=h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment