flydata 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27e7790138861ddd0365bc10c4e54f2056422f38
4
+ data.tar.gz: aed30d2c9fec66feb6c8f81494bb094b0e4d18cb
5
+ SHA512:
6
+ metadata.gz: fe887c1c0ba2f691dab8fd7bb0b6cc52b7f6491c77e379b2885de1eed9e3e2bde3e21193ca86e3d7c74246a643f6e6fff06d138f6faba7f3cd88772561e4a775
7
+ data.tar.gz: f6025778c94470895a1d030a2898b4d5d7bf4679a2c3b5ab3c2bc1cd670949c1839b123526511a27fef4430a6bc90c4f3e4f108fc090b8bd426c94dc9b05de94
data/Gemfile CHANGED
@@ -1,29 +1,28 @@
1
1
  source "http://rubygems.org"
2
2
  source "https://rubygems.flydata.com"
3
3
 
4
- gem "rest-client", "~> 1.6.7"
5
- gem "i18n", "~> 0.6.5"
6
- gem "activesupport", "~> 4.0.0"
7
- gem "json", "~> 1.8.0"
8
- gem "highline", "~> 1.6.19"
4
+ gem "rest-client", '~> 1.6', '>= 1.6.7'
5
+ gem "i18n", '~> 0.6', '>= 0.6.5'
6
+ gem "activesupport", '~> 4.0', '>= 4.0.0'
7
+ gem "json", '~> 1.8', '>= 1.8.0'
8
+ gem "highline", '~> 1.6', '>= 1.6.19'
9
9
  gem "fluentd", "0.10.46"
10
- gem "ruby-binlog", ">= 1.0.1"
11
- gem "fluent-plugin-mysql-binlog", "~> 0.0.2"
12
- gem "mysql2", "~> 0.3.11"
13
- gem "slop"
14
- gem "treetop"
10
+ gem "ruby-binlog", '~> 1.0', '>= 1.0.1'
11
+ gem "fluent-plugin-mysql-binlog", '~> 0.0', '>= 0.0.2'
12
+ gem "mysql2", '~> 0.3', '>= 0.3.11'
13
+ gem "slop", '~> 3.4', '>= 3.4.6'
14
+ gem "treetop", '~> 1.5', '>= 1.5.3'
15
15
 
16
16
  group :development do
17
- gem "bundler"
18
- gem "jeweler"
17
+ gem "jeweler", '~> 1.8', '>= 1.8.8'
19
18
  gem "rspec", '~> 3.0'
20
19
  #gem "autotest"
21
20
  #gem "autotest-standalone"
22
21
  #gem "autotest-notification"
23
- gem 'timecop'
24
- gem "sqlite3"
25
- gem 'ruby-prof'
26
- gem 'activemodel', '~> 4.0.0'
27
- gem 'activerecord', '~> 4.0.0'
28
- gem 'protected_attributes'
22
+ gem 'timecop', '~> 0.7', '>= 0.7.1'
23
+ gem "sqlite3", '~> 0.1', '>= 0.1.1'
24
+ gem 'ruby-prof', '~> 0.15', '>= 0.15.1'
25
+ gem 'activemodel', '~> 4.0', '>= 4.0.0'
26
+ gem 'activerecord', '~> 4.0', '>= 4.0.0'
27
+ gem 'protected_attributes', '~> 1.0', '>= 1.0.8'
29
28
  end
data/Gemfile.lock CHANGED
@@ -2,29 +2,27 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  remote: https://rubygems.flydata.com/
4
4
  specs:
5
- activemodel (4.0.0)
6
- activesupport (= 4.0.0)
7
- builder (~> 3.1.0)
8
- activerecord (4.0.0)
9
- activemodel (= 4.0.0)
10
- activerecord-deprecated_finders (~> 1.0.2)
11
- activesupport (= 4.0.0)
12
- arel (~> 4.0.0)
13
- activerecord-deprecated_finders (1.0.3)
14
- activesupport (4.0.0)
15
- i18n (~> 0.6, >= 0.6.4)
16
- minitest (~> 4.2)
17
- multi_json (~> 1.3)
5
+ activemodel (4.1.4)
6
+ activesupport (= 4.1.4)
7
+ builder (~> 3.1)
8
+ activerecord (4.1.4)
9
+ activemodel (= 4.1.4)
10
+ activesupport (= 4.1.4)
11
+ arel (~> 5.0.0)
12
+ activesupport (4.1.4)
13
+ i18n (~> 0.6, >= 0.6.9)
14
+ json (~> 1.7, >= 1.7.7)
15
+ minitest (~> 5.1)
18
16
  thread_safe (~> 0.1)
19
- tzinfo (~> 0.3.37)
20
- addressable (2.3.5)
21
- arel (4.0.2)
22
- atomic (1.1.14)
23
- builder (3.1.4)
24
- cool.io (1.2.3)
17
+ tzinfo (~> 1.1)
18
+ addressable (2.3.6)
19
+ arel (5.0.1.20140414130214)
20
+ builder (3.2.2)
21
+ cool.io (1.2.4)
25
22
  diff-lcs (1.2.5)
26
- faraday (0.8.8)
23
+ faraday (0.8.9)
27
24
  multipart-post (~> 1.2.0)
25
+ ffi (1.9.3)
28
26
  fluent-plugin-mysql-binlog (0.0.2)
29
27
  activesupport
30
28
  fluentd
@@ -36,7 +34,7 @@ GEM
36
34
  msgpack (>= 0.4.4, < 0.6.0, != 0.5.3, != 0.5.2, != 0.5.1, != 0.5.0)
37
35
  sigdump (~> 0.2.2)
38
36
  yajl-ruby (~> 1.0)
39
- git (1.2.6)
37
+ git (1.2.8)
40
38
  github_api (0.10.1)
41
39
  addressable
42
40
  faraday (~> 0.8.1)
@@ -44,11 +42,10 @@ GEM
44
42
  multi_json (~> 1.4)
45
43
  nokogiri (~> 1.5.2)
46
44
  oauth2
47
- hashie (2.0.5)
48
- highline (1.6.19)
45
+ hashie (3.2.0)
46
+ highline (1.6.21)
49
47
  http_parser.rb (0.6.0)
50
- httpauth (0.2.0)
51
- i18n (0.6.5)
48
+ i18n (0.6.11)
52
49
  jeweler (1.8.8)
53
50
  builder
54
51
  bundler (~> 1.0)
@@ -59,80 +56,80 @@ GEM
59
56
  rake
60
57
  rdoc
61
58
  json (1.8.1)
62
- jwt (0.1.8)
63
- multi_json (>= 1.5)
59
+ jwt (1.0.0)
64
60
  kodama (0.1.1)
65
61
  ruby-binlog (>= 0.1.9)
66
- mime-types (1.25)
67
- minitest (4.7.5)
62
+ mime-types (2.3)
63
+ minitest (5.4.0)
68
64
  msgpack (0.5.8)
69
- multi_json (1.8.2)
65
+ multi_json (1.10.1)
70
66
  multi_xml (0.5.5)
71
67
  multipart-post (1.2.0)
72
- mysql2 (0.3.11)
68
+ mysql2 (0.3.16)
69
+ netrc (0.7.7)
73
70
  nokogiri (1.5.10)
74
- oauth2 (0.9.2)
75
- faraday (~> 0.8)
76
- httpauth (~> 0.2)
77
- jwt (~> 0.1.4)
78
- multi_json (~> 1.0)
71
+ oauth2 (1.0.0)
72
+ faraday (>= 0.8, < 0.10)
73
+ jwt (~> 1.0)
74
+ multi_json (~> 1.3)
79
75
  multi_xml (~> 0.5)
80
76
  rack (~> 1.2)
81
77
  polyglot (0.3.5)
82
- protected_attributes (1.0.3)
83
- activemodel (>= 4.0.0, < 5.0)
78
+ protected_attributes (1.0.8)
79
+ activemodel (>= 4.0.1, < 5.0)
84
80
  rack (1.5.2)
85
- rake (10.1.0)
86
- rdoc (4.0.1)
81
+ rake (10.3.2)
82
+ rdoc (4.1.1)
87
83
  json (~> 1.4)
88
- rest-client (1.6.7)
89
- mime-types (>= 1.16)
84
+ rest-client (1.7.2)
85
+ mime-types (>= 1.16, < 3.0)
86
+ netrc (~> 0.7)
90
87
  rspec (3.0.0)
91
88
  rspec-core (~> 3.0.0)
92
89
  rspec-expectations (~> 3.0.0)
93
90
  rspec-mocks (~> 3.0.0)
94
- rspec-core (3.0.2)
91
+ rspec-core (3.0.3)
95
92
  rspec-support (~> 3.0.0)
96
- rspec-expectations (3.0.2)
93
+ rspec-expectations (3.0.3)
97
94
  diff-lcs (>= 1.2.0, < 2.0)
98
95
  rspec-support (~> 3.0.0)
99
- rspec-mocks (3.0.2)
96
+ rspec-mocks (3.0.3)
100
97
  rspec-support (~> 3.0.0)
101
- rspec-support (3.0.2)
98
+ rspec-support (3.0.3)
102
99
  ruby-binlog (1.0.1)
103
- ruby-prof (0.14.2)
100
+ ruby-prof (0.15.1)
104
101
  sigdump (0.2.2)
105
- slop (3.4.6)
106
- sqlite3 (1.3.8)
107
- thread_safe (0.1.3)
108
- atomic
102
+ slop (3.6.0)
103
+ sqlite3 (0.1.1)
104
+ ffi (>= 0.6.3)
105
+ thread_safe (0.3.4)
109
106
  timecop (0.7.1)
110
107
  treetop (1.5.3)
111
108
  polyglot (~> 0.3)
112
- tzinfo (0.3.38)
113
- yajl-ruby (1.2.0)
109
+ tzinfo (1.2.1)
110
+ thread_safe (~> 0.1)
111
+ yajl-ruby (1.2.1)
114
112
 
115
113
  PLATFORMS
116
114
  ruby
117
115
 
118
116
  DEPENDENCIES
119
- activemodel (~> 4.0.0)
120
- activerecord (~> 4.0.0)
121
- activesupport (~> 4.0.0)
122
- bundler
123
- fluent-plugin-mysql-binlog (~> 0.0.2)
117
+ activemodel (~> 4.0, >= 4.0.0)
118
+ activerecord (~> 4.0, >= 4.0.0)
119
+ activesupport (~> 4.0, >= 4.0.0)
120
+ fluent-plugin-mysql-binlog (~> 0.0, >= 0.0.2)
124
121
  fluentd (= 0.10.46)
125
- highline (~> 1.6.19)
126
- i18n (~> 0.6.5)
127
- jeweler
128
- json (~> 1.8.0)
129
- mysql2 (~> 0.3.11)
130
- protected_attributes
131
- rest-client (~> 1.6.7)
122
+ highline (~> 1.6, >= 1.6.19)
123
+ i18n (~> 0.6, >= 0.6.5)
124
+ jeweler (~> 1.8, >= 1.8.8)
125
+ json (~> 1.8, >= 1.8.0)
126
+ mysql2 (~> 0.3, >= 0.3.11)
127
+ protected_attributes (~> 1.0, >= 1.0.8)
128
+ rest-client (~> 1.6, >= 1.6.7)
132
129
  rspec (~> 3.0)
133
- ruby-binlog (>= 1.0.1)
134
- ruby-prof
135
- slop
136
- sqlite3
137
- timecop
138
- treetop
130
+ ruby-binlog (~> 1.0, >= 1.0.1)
131
+ ruby-prof (~> 0.15, >= 0.15.1)
132
+ slop (~> 3.4, >= 3.4.6)
133
+ sqlite3 (~> 0.1, >= 0.1.1)
134
+ timecop (~> 0.7, >= 0.7.1)
135
+ treetop (~> 1.5, >= 1.5.3)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.12
1
+ 0.1.13
data/flydata.gemspec CHANGED
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: flydata 0.1.13 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "flydata"
8
- s.version = "0.1.12"
9
+ s.version = "0.1.13"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Koichi Fujikawa"]
12
- s.date = "2014-07-30"
14
+ s.date = "2014-08-05"
13
15
  s.description = "FlyData Command Line Interface"
14
16
  s.email = "sysadmin@flydata.co"
15
17
  s.executables = ["fdmysqldump", "flydata"]
@@ -58,6 +60,7 @@ Gem::Specification.new do |s|
58
60
  "lib/flydata/fluent-plugins/mysql/binlog_record_dispatcher.rb",
59
61
  "lib/flydata/fluent-plugins/mysql/binlog_record_handler.rb",
60
62
  "lib/flydata/fluent-plugins/mysql/context.rb",
63
+ "lib/flydata/fluent-plugins/mysql/ddl_query_handler.rb",
61
64
  "lib/flydata/fluent-plugins/mysql/dml_record_handler.rb",
62
65
  "lib/flydata/fluent-plugins/out_forward_ssl.rb",
63
66
  "lib/flydata/fluent-plugins/preference.rb",
@@ -103,77 +106,73 @@ Gem::Specification.new do |s|
103
106
  ]
104
107
  s.homepage = "http://flydata.co/"
105
108
  s.licenses = ["All right reserved."]
106
- s.require_paths = ["lib"]
107
- s.rubygems_version = "1.8.28"
109
+ s.rubygems_version = "2.2.2"
108
110
  s.summary = "FlyData CLI"
109
111
 
110
112
  if s.respond_to? :specification_version then
111
- s.specification_version = 3
113
+ s.specification_version = 4
112
114
 
113
115
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
114
- s.add_runtime_dependency(%q<rest-client>, ["~> 1.6.7"])
115
- s.add_runtime_dependency(%q<i18n>, ["~> 0.6.5"])
116
- s.add_runtime_dependency(%q<activesupport>, ["~> 4.0.0"])
117
- s.add_runtime_dependency(%q<json>, ["~> 1.8.0"])
118
- s.add_runtime_dependency(%q<highline>, ["~> 1.6.19"])
116
+ s.add_runtime_dependency(%q<rest-client>, [">= 1.6.7", "~> 1.6"])
117
+ s.add_runtime_dependency(%q<i18n>, [">= 0.6.5", "~> 0.6"])
118
+ s.add_runtime_dependency(%q<activesupport>, [">= 4.0.0", "~> 4.0"])
119
+ s.add_runtime_dependency(%q<json>, [">= 1.8.0", "~> 1.8"])
120
+ s.add_runtime_dependency(%q<highline>, [">= 1.6.19", "~> 1.6"])
119
121
  s.add_runtime_dependency(%q<fluentd>, ["= 0.10.46"])
120
- s.add_runtime_dependency(%q<ruby-binlog>, [">= 1.0.1"])
121
- s.add_runtime_dependency(%q<fluent-plugin-mysql-binlog>, ["~> 0.0.2"])
122
- s.add_runtime_dependency(%q<mysql2>, ["~> 0.3.11"])
123
- s.add_runtime_dependency(%q<slop>, [">= 0"])
124
- s.add_runtime_dependency(%q<treetop>, [">= 0"])
125
- s.add_development_dependency(%q<bundler>, [">= 0"])
126
- s.add_development_dependency(%q<jeweler>, [">= 0"])
122
+ s.add_runtime_dependency(%q<ruby-binlog>, [">= 1.0.1", "~> 1.0"])
123
+ s.add_runtime_dependency(%q<fluent-plugin-mysql-binlog>, [">= 0.0.2", "~> 0.0"])
124
+ s.add_runtime_dependency(%q<mysql2>, [">= 0.3.11", "~> 0.3"])
125
+ s.add_runtime_dependency(%q<slop>, [">= 3.4.6", "~> 3.4"])
126
+ s.add_runtime_dependency(%q<treetop>, [">= 1.5.3", "~> 1.5"])
127
+ s.add_development_dependency(%q<jeweler>, [">= 1.8.8", "~> 1.8"])
127
128
  s.add_development_dependency(%q<rspec>, ["~> 3.0"])
128
- s.add_development_dependency(%q<timecop>, [">= 0"])
129
- s.add_development_dependency(%q<sqlite3>, [">= 0"])
130
- s.add_development_dependency(%q<ruby-prof>, [">= 0"])
131
- s.add_development_dependency(%q<activemodel>, ["~> 4.0.0"])
132
- s.add_development_dependency(%q<activerecord>, ["~> 4.0.0"])
133
- s.add_development_dependency(%q<protected_attributes>, [">= 0"])
129
+ s.add_development_dependency(%q<timecop>, [">= 0.7.1", "~> 0.7"])
130
+ s.add_development_dependency(%q<sqlite3>, [">= 0.1.1", "~> 0.1"])
131
+ s.add_development_dependency(%q<ruby-prof>, [">= 0.15.1", "~> 0.15"])
132
+ s.add_development_dependency(%q<activemodel>, [">= 4.0.0", "~> 4.0"])
133
+ s.add_development_dependency(%q<activerecord>, [">= 4.0.0", "~> 4.0"])
134
+ s.add_development_dependency(%q<protected_attributes>, [">= 1.0.8", "~> 1.0"])
134
135
  else
135
- s.add_dependency(%q<rest-client>, ["~> 1.6.7"])
136
- s.add_dependency(%q<i18n>, ["~> 0.6.5"])
137
- s.add_dependency(%q<activesupport>, ["~> 4.0.0"])
138
- s.add_dependency(%q<json>, ["~> 1.8.0"])
139
- s.add_dependency(%q<highline>, ["~> 1.6.19"])
136
+ s.add_dependency(%q<rest-client>, [">= 1.6.7", "~> 1.6"])
137
+ s.add_dependency(%q<i18n>, [">= 0.6.5", "~> 0.6"])
138
+ s.add_dependency(%q<activesupport>, [">= 4.0.0", "~> 4.0"])
139
+ s.add_dependency(%q<json>, [">= 1.8.0", "~> 1.8"])
140
+ s.add_dependency(%q<highline>, [">= 1.6.19", "~> 1.6"])
140
141
  s.add_dependency(%q<fluentd>, ["= 0.10.46"])
141
- s.add_dependency(%q<ruby-binlog>, [">= 1.0.1"])
142
- s.add_dependency(%q<fluent-plugin-mysql-binlog>, ["~> 0.0.2"])
143
- s.add_dependency(%q<mysql2>, ["~> 0.3.11"])
144
- s.add_dependency(%q<slop>, [">= 0"])
145
- s.add_dependency(%q<treetop>, [">= 0"])
146
- s.add_dependency(%q<bundler>, [">= 0"])
147
- s.add_dependency(%q<jeweler>, [">= 0"])
142
+ s.add_dependency(%q<ruby-binlog>, [">= 1.0.1", "~> 1.0"])
143
+ s.add_dependency(%q<fluent-plugin-mysql-binlog>, [">= 0.0.2", "~> 0.0"])
144
+ s.add_dependency(%q<mysql2>, [">= 0.3.11", "~> 0.3"])
145
+ s.add_dependency(%q<slop>, [">= 3.4.6", "~> 3.4"])
146
+ s.add_dependency(%q<treetop>, [">= 1.5.3", "~> 1.5"])
147
+ s.add_dependency(%q<jeweler>, [">= 1.8.8", "~> 1.8"])
148
148
  s.add_dependency(%q<rspec>, ["~> 3.0"])
149
- s.add_dependency(%q<timecop>, [">= 0"])
150
- s.add_dependency(%q<sqlite3>, [">= 0"])
151
- s.add_dependency(%q<ruby-prof>, [">= 0"])
152
- s.add_dependency(%q<activemodel>, ["~> 4.0.0"])
153
- s.add_dependency(%q<activerecord>, ["~> 4.0.0"])
154
- s.add_dependency(%q<protected_attributes>, [">= 0"])
149
+ s.add_dependency(%q<timecop>, [">= 0.7.1", "~> 0.7"])
150
+ s.add_dependency(%q<sqlite3>, [">= 0.1.1", "~> 0.1"])
151
+ s.add_dependency(%q<ruby-prof>, [">= 0.15.1", "~> 0.15"])
152
+ s.add_dependency(%q<activemodel>, [">= 4.0.0", "~> 4.0"])
153
+ s.add_dependency(%q<activerecord>, [">= 4.0.0", "~> 4.0"])
154
+ s.add_dependency(%q<protected_attributes>, [">= 1.0.8", "~> 1.0"])
155
155
  end
156
156
  else
157
- s.add_dependency(%q<rest-client>, ["~> 1.6.7"])
158
- s.add_dependency(%q<i18n>, ["~> 0.6.5"])
159
- s.add_dependency(%q<activesupport>, ["~> 4.0.0"])
160
- s.add_dependency(%q<json>, ["~> 1.8.0"])
161
- s.add_dependency(%q<highline>, ["~> 1.6.19"])
157
+ s.add_dependency(%q<rest-client>, [">= 1.6.7", "~> 1.6"])
158
+ s.add_dependency(%q<i18n>, [">= 0.6.5", "~> 0.6"])
159
+ s.add_dependency(%q<activesupport>, [">= 4.0.0", "~> 4.0"])
160
+ s.add_dependency(%q<json>, [">= 1.8.0", "~> 1.8"])
161
+ s.add_dependency(%q<highline>, [">= 1.6.19", "~> 1.6"])
162
162
  s.add_dependency(%q<fluentd>, ["= 0.10.46"])
163
- s.add_dependency(%q<ruby-binlog>, [">= 1.0.1"])
164
- s.add_dependency(%q<fluent-plugin-mysql-binlog>, ["~> 0.0.2"])
165
- s.add_dependency(%q<mysql2>, ["~> 0.3.11"])
166
- s.add_dependency(%q<slop>, [">= 0"])
167
- s.add_dependency(%q<treetop>, [">= 0"])
168
- s.add_dependency(%q<bundler>, [">= 0"])
169
- s.add_dependency(%q<jeweler>, [">= 0"])
163
+ s.add_dependency(%q<ruby-binlog>, [">= 1.0.1", "~> 1.0"])
164
+ s.add_dependency(%q<fluent-plugin-mysql-binlog>, [">= 0.0.2", "~> 0.0"])
165
+ s.add_dependency(%q<mysql2>, [">= 0.3.11", "~> 0.3"])
166
+ s.add_dependency(%q<slop>, [">= 3.4.6", "~> 3.4"])
167
+ s.add_dependency(%q<treetop>, [">= 1.5.3", "~> 1.5"])
168
+ s.add_dependency(%q<jeweler>, [">= 1.8.8", "~> 1.8"])
170
169
  s.add_dependency(%q<rspec>, ["~> 3.0"])
171
- s.add_dependency(%q<timecop>, [">= 0"])
172
- s.add_dependency(%q<sqlite3>, [">= 0"])
173
- s.add_dependency(%q<ruby-prof>, [">= 0"])
174
- s.add_dependency(%q<activemodel>, ["~> 4.0.0"])
175
- s.add_dependency(%q<activerecord>, ["~> 4.0.0"])
176
- s.add_dependency(%q<protected_attributes>, [">= 0"])
170
+ s.add_dependency(%q<timecop>, [">= 0.7.1", "~> 0.7"])
171
+ s.add_dependency(%q<sqlite3>, [">= 0.1.1", "~> 0.1"])
172
+ s.add_dependency(%q<ruby-prof>, [">= 0.15.1", "~> 0.15"])
173
+ s.add_dependency(%q<activemodel>, [">= 4.0.0", "~> 4.0"])
174
+ s.add_dependency(%q<activerecord>, [">= 4.0.0", "~> 4.0"])
175
+ s.add_dependency(%q<protected_attributes>, [">= 1.0.8", "~> 1.0"])
177
176
  end
178
177
  end
179
178
 
@@ -165,6 +165,8 @@ module Flydata
165
165
  raise "mysqldump is not installed. mysqldump is required to run the command"
166
166
  end
167
167
 
168
+ schema_name = (de['schema_name'] || nil)
169
+
168
170
  mp = de['mysql_data_entry_preference']
169
171
  params = []
170
172
  if mp['host'] then params << mp['host'] else raise "MySQL `host` is not defined in the data entry" end
@@ -186,7 +188,7 @@ module Flydata
186
188
  break
187
189
  end
188
190
  flydata_tabledef = mysql_tabledef.to_flydata_tabledef
189
- puts Flydata::TableDef::RedshiftTableDef.from_flydata_tabledef(flydata_tabledef, flydata_ctl_table: create_flydata_ctl_table)
191
+ puts Flydata::TableDef::RedshiftTableDef.from_flydata_tabledef(flydata_tabledef, flydata_ctl_table: create_flydata_ctl_table, schema_name: schema_name)
190
192
  create_flydata_ctl_table = false
191
193
  end
192
194
  while !stderr.eof?
@@ -1,9 +1,9 @@
1
1
  require 'flydata/parser_provider'
2
- require_relative 'binlog_query_handler'
2
+ require_relative 'ddl_query_handler'
3
3
 
4
4
  module Mysql
5
- class AlterTableQueryHandler < BinlogQueryHandler
6
- PATTERN = /^alter table/
5
+ class AlterTableQueryHandler < DdlQueryHandler
6
+ PATTERN = /^ALTER TABLE/i
7
7
 
8
8
  def initialize(context)
9
9
  super
@@ -14,16 +14,15 @@ module Mysql
14
14
  end
15
15
 
16
16
  def process(record, normalized_query)
17
- $log.debug("Alter table is not supported now. query:'#{record['query']}'")
18
- #emit_record(:alter_table, record, increment_table_rev: true) do
19
- # result = ParserProvider.parser(:mysql, :mysql_alter_table).new.parse(record['query'])
20
- # if result.nil?
21
- # $log.warn("Recieved not supported alter table query. query:'#{record['query']}'")
22
- # nil
23
- # else
24
- # result.tree
25
- # end
26
- #end
17
+ emit_record(:alter_table, record, increment_table_rev: true) do
18
+ result = ParserProvider.parser(:mysql, :mysql_alter_table).new.parse(record['query'])
19
+ if result.nil?
20
+ $log.warn("Recieved not supported alter table query. query:'#{record['query']}'")
21
+ nil
22
+ else
23
+ result.tree
24
+ end
25
+ end
27
26
  end
28
27
  end
29
28
  end
@@ -32,7 +32,8 @@ module Mysql
32
32
  class FlydataBinlogQueryDispatcher < BinlogQueryDispatcher
33
33
  def initialize(context)
34
34
  @handlers = [
35
- AlterTableQueryHandler.new(context),
35
+ # TODO Uncomment below to enable AlterTable support
36
+ # AlterTableQueryHandler.new(context),
36
37
  ]
37
38
  end
38
39
  end
@@ -27,8 +27,12 @@ module Mysql
27
27
 
28
28
  private
29
29
 
30
- def acceptable_db?(db_name)
31
- @context.database == db_name
30
+ def supported_database
31
+ @context.database
32
+ end
33
+
34
+ def acceptable_db?(record)
35
+ supported_database == record["db_name"]
32
36
  end
33
37
 
34
38
  def acceptable_table?(record, table)
@@ -47,7 +51,7 @@ module Mysql
47
51
  end
48
52
 
49
53
  def emit_record(type, record, opt = {})
50
- return unless acceptable_db?(record["db_name"])
54
+ return unless acceptable_db?(record)
51
55
  return unless record["table_name"].nil? or acceptable_table?(record, record["table_name"])
52
56
 
53
57
  check_empty_binlog
@@ -0,0 +1,22 @@
1
+ require_relative 'binlog_query_handler'
2
+
3
+ module Mysql
4
+
5
+ class DdlQueryHandler < BinlogQueryHandler
6
+ DDL_TABLE_QUERY = /^(?:(?:ALTER|CREATE|DROP|RENAME) +(?:\w+ +)*TABLE +([^ ]+)|TRUNCATE +(?:TABLE +)?([^ ]+))/i
7
+
8
+ def acceptable_db?(record)
9
+ db_name = record["db_name"]
10
+ if DDL_TABLE_QUERY =~ record["query"]
11
+ table_name_in_query = $1 ? $1 : $2
12
+
13
+ if (idx = table_name_in_query.index("."))
14
+ db_name = table_name_in_query[0...idx].tr("`", "")
15
+ end
16
+ end
17
+
18
+ supported_database == db_name
19
+ end
20
+ end
21
+
22
+ end
@@ -18,11 +18,13 @@ grammar MysqlAlterTable
18
18
  alter_key sp online_option ignore_option table_key sp tbl_name
19
19
  sp alter_specs (sp partition_opts)? {
20
20
  def tree
21
- {
21
+ value = {
22
22
  type: :alter_table,
23
- table_name: tbl_name.text_value,
23
+ table_name: tbl_name.table_part.text_value,
24
24
  actions: alter_specs.actions
25
25
  }
26
+ value[:schema_name] = tbl_name.schema_part.text_value if tbl_name.has_schema?
27
+ value
26
28
  end
27
29
  }
28
30
  end
@@ -248,6 +250,25 @@ grammar MysqlAlterTable
248
250
  ######## Common rules
249
251
 
250
252
  rule tbl_name
253
+ ( schema_part dot )? table_part {
254
+ def has_schema?
255
+ elements[0].respond_to? :schema_part
256
+ end
257
+ def schema_part
258
+ if has_schema?
259
+ elements[0].schema_part
260
+ else
261
+ nil
262
+ end
263
+ end
264
+ }
265
+ end
266
+
267
+ rule schema_part
268
+ ident_sys
269
+ end
270
+
271
+ rule table_part
251
272
  ident_sys
252
273
  end
253
274
 
@@ -299,4 +320,8 @@ grammar MysqlAlterTable
299
320
  rule nsp
300
321
  [\s]*
301
322
  end
323
+
324
+ rule dot
325
+ '.'
326
+ end
302
327
  end