trinamo 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db69701cc52386eb208707e1140e5175e8d03189
4
- data.tar.gz: 146681b611611fde087a1c4b3c02a8dd1a84e8a2
3
+ metadata.gz: 43126b906d5b2f56562c3fa82ac4bc3e1ccd5f03
4
+ data.tar.gz: efb501f1be013df0807d42baa860ebc7180a064f
5
5
  SHA512:
6
- metadata.gz: 26ab74658efe62586153b2ddaaff0de883d88e28a017a4c4d1ef76490ecf0cb0715130cea791e92cd6c13ca2190d9a8da672fb65f2515be78896c74998e4dc22
7
- data.tar.gz: cccb9b72a8da804015b864c639c5dbeb3e1485dfef0630251e8602fd4effa66651df3e4eb13af81f79c98a1ddfe4410fb1f1ff0532aebfb1950ec984b7088bb0
6
+ metadata.gz: 193b298c7f4cf4a99ae5f31a56a80e76b24b732d3c63a5aef5358c2578add7cd2fe02df2779af3a33a57e4a31cfb31040696fe769c72e89b8f6cdbf1f3c1b442
7
+ data.tar.gz: 0b33d8b4fcfabdb0b4e9ec7c1690faa2e2b1aed0e46c790a24fac641d74231bac76911fe2cbfba4aaaa553b8126472a9e1c191225542d1daa8ce0a3b5d762ebb
@@ -65,6 +65,10 @@ module Trinamo
65
65
  File.binwrite(out_file_path, template) if out_file_path
66
66
  template
67
67
  end
68
+
69
+ def remove_head_underscore(raw_table_name)
70
+ /^_(.+)/ =~ raw_table_name ? $1 : raw_table_name
71
+ end
68
72
  end
69
73
  end
70
74
  end
@@ -6,8 +6,8 @@ module Trinamo
6
6
  ddl_body = @ddl[:tables].map do |h|
7
7
  fields = ([h[:hash_key]] + [h[:range_key]] + [h[:attributes]]).flatten.compact
8
8
  <<-DDL.unindent
9
- -- #{h[:name]}_ddb
10
- CREATE EXTERNAL TABLE #{h[:name]}_ddb (
9
+ -- #{Trinamo::Converter.remove_head_underscore(h[:name])}_ddb
10
+ CREATE EXTERNAL TABLE #{Trinamo::Converter.remove_head_underscore(h[:name])}_ddb (
11
11
  #{fields.map { |attr| "#{attr[:name]} #{attr[:type].upcase}" }.join(',')}
12
12
  )
13
13
  STORED BY 'org.apache.hadoop.hive.dynamodb.DynamoDBStorageHandler'
@@ -6,8 +6,8 @@ module Trinamo
6
6
  ddl_body = @ddl[:tables].map do |h|
7
7
  fields = ([h[:hash_key]] + [h[:range_key]] + [h[:attributes]]).flatten.compact
8
8
  <<-DDL.unindent
9
- -- #{h[:name]}_hdfs
10
- CREATE TABLE #{h[:name]}_hdfs (
9
+ -- #{Trinamo::Converter.remove_head_underscore(h[:name])}_hdfs
10
+ CREATE TABLE #{Trinamo::Converter.remove_head_underscore(h[:name])}_hdfs (
11
11
  #{fields.map { |attr| "#{attr[:name]} #{attr[:type].upcase}" }.join(',')}
12
12
  );
13
13
  DDL
@@ -9,14 +9,14 @@ module Trinamo
9
9
  partitioned_by = h[:s3_partition] ? "PARTITIONED BY (#{h[:s3_partition].map { |attr| "#{attr[:name]} #{attr[:type].upcase}" }.join(',')})" : ''
10
10
  <<-DDL.unindent
11
11
  -- #{h[:name]}_s3
12
- CREATE EXTERNAL TABLE #{h[:name]}_s3 (
12
+ CREATE EXTERNAL TABLE #{Trinamo::Converter.remove_head_underscore(h[:name])}_s3 (
13
13
  #{fields.map { |attr| "#{attr[:name]} #{attr[:type].upcase}" }.join(',')}
14
14
  ) #{partitioned_by}
15
15
  ROW FORMAT DELIMITED FIELDS TERMINATED BY '\\t' LINES TERMINATED BY '\\n'
16
16
  LOCATION '#{h[:s3_location]}';
17
17
  DDL
18
18
  else
19
- STDERR.puts "[ERROR] The location of #{h[:name]}_s3 is not found"
19
+ STDERR.puts "[ERROR] The location of #{Trinamo::Converter.remove_head_underscore(h[:name])}_s3 is not found"
20
20
  nil
21
21
  end
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module Trinamo
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trinamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - cignoir
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-10 00:00:00.000000000 Z
11
+ date: 2016-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport