trinamo 0.3.0 → 0.3.1

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: e454cf16de7a293b800e5a0b5df17f25f41ec906
4
- data.tar.gz: c2d1f3752aa75cc7e49f5c467f5a23dc7d6f5eeb
3
+ metadata.gz: db69701cc52386eb208707e1140e5175e8d03189
4
+ data.tar.gz: 146681b611611fde087a1c4b3c02a8dd1a84e8a2
5
5
  SHA512:
6
- metadata.gz: 1bba7a9132864946c464ed01b026cdd578ffa33f8f171fb5602a222000b0e30b945942eb6fde05732f0d22dab7ddf16e45337e99c23ab49e3416b155ddd5c0e2
7
- data.tar.gz: d7010d9882d28dee138a9e9984090b04f97ef1553b517bb34bdb210a057c28bdd6ccacd43066da2877b31b4acc9dae5149683730dc20c50061baa486bf116240
6
+ metadata.gz: 26ab74658efe62586153b2ddaaff0de883d88e28a017a4c4d1ef76490ecf0cb0715130cea791e92cd6c13ca2190d9a8da672fb65f2515be78896c74998e4dc22
7
+ data.tar.gz: cccb9b72a8da804015b864c639c5dbeb3e1485dfef0630251e8602fd4effa66651df3e4eb13af81f79c98a1ddfe4410fb1f1ff0532aebfb1950ec984b7088bb0
data/README.md CHANGED
@@ -5,11 +5,6 @@
5
5
 
6
6
  Trinamo generates HiveQL using YAML to mount tables of DynamoDB, S3 and local HDFS.
7
7
 
8
- ```
9
- Notice:
10
- This is experimental stuff! Do not use in production.
11
- ```
12
-
13
8
  ## Installation
14
9
 
15
10
  Add this line to your application's Gemfile:
@@ -5,9 +5,17 @@ module Trinamo
5
5
  class BaseConverter
6
6
  attr_accessor :ddl_yaml_path, :ddl
7
7
 
8
- def initialize(ddl_yaml_path)
8
+ def initialize(ddl_yaml_path, ddl = nil)
9
9
  @ddl_yaml_path = ddl_yaml_path
10
- @ddl = ddl_yaml_path ? YAML.load_file(ddl_yaml_path).deep_symbolize_keys : nil
10
+ @ddl = if ddl
11
+ ddl
12
+ else
13
+ ddl_yaml_path ? YAML.load_file(ddl_yaml_path).deep_symbolize_keys : nil
14
+ end
15
+ end
16
+
17
+ def convert(format)
18
+ Trinamo::Converter.load(@ddl_yaml_path, format, @ddl).convert
11
19
  end
12
20
  end
13
21
  end
@@ -1,4 +1,5 @@
1
1
  require 'unindent'
2
+ require_relative './converter/base_converter'
2
3
  require_relative './converter/dynamodb_converter'
3
4
  require_relative './converter/hdfs_converter'
4
5
  require_relative './converter/s3_converter'
@@ -7,20 +8,17 @@ require_relative './converter/option_converter'
7
8
  module Trinamo
8
9
  class Converter
9
10
  class << self
10
- def load(ddl_yaml_path, format)
11
+ def load(ddl_yaml_path, format = nil, ddl = nil)
11
12
  case format
12
- when :hdfs then HdfsConverter.new(ddl_yaml_path)
13
- when :s3 then S3Converter.new(ddl_yaml_path)
14
- when :dynamodb then DynamodbConverter.new(ddl_yaml_path)
15
- when :option || :options then load_options(ddl_yaml_path)
16
- else raise "[ERROR] Unknown format: #{format}" unless [:dynamodb, :hdfs, :s3].include(format)
13
+ when :hdfs then HdfsConverter.new(ddl_yaml_path, ddl)
14
+ when :s3 then S3Converter.new(ddl_yaml_path, ddl)
15
+ when :dynamodb then DynamodbConverter.new(ddl_yaml_path, ddl)
16
+ when :option then OptionConverter.new(ddl_yaml_path, ddl)
17
+ when nil then BaseConverter.new(ddl_yaml_path, ddl)
18
+ else raise "[ERROR] Unknown format: #{format}"
17
19
  end
18
20
  end
19
21
 
20
- def load_options(options_yaml_path)
21
- OptionConverter.new(options_yaml_path)
22
- end
23
-
24
22
  def generate_ddl_template(out_file_path = nil)
25
23
  template = <<-TEMPLATE.unindent
26
24
  tables:
@@ -1,3 +1,3 @@
1
1
  module Trinamo
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trinamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - cignoir