flydata 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/VERSION +1 -1
- data/flydata.gemspec +8 -3
- data/lib/flydata/cli.rb +7 -1
- data/lib/flydata/command/base.rb +3 -1
- data/lib/flydata/command/sender.rb +57 -46
- data/lib/flydata/command/setup.rb +84 -17
- data/lib/flydata/command/start.rb +4 -1
- data/lib/flydata/command/sync.rb +130 -55
- data/lib/flydata/helpers.rb +12 -3
- data/lib/flydata/table_def/mysql_table_def.rb +7 -4
- data/lib/flydata/table_def/redshift_table_def.rb +13 -6
- data/spec/flydata/cli_spec.rb +172 -0
- data/spec/flydata/command/sender_spec.rb +39 -1
- data/spec/flydata/command/sync_spec.rb +85 -14
- data/spec/flydata/table_def/mysql_table_def_spec.rb +21 -4
- data/spec/flydata/table_def/mysqldump_test_unsigned.dump +47 -0
- data/spec/flydata/table_def/redshift_table_def_spec.rb +45 -0
- metadata +22 -4
@@ -0,0 +1,47 @@
|
|
1
|
+
-- MySQL dump 10.13 Distrib 5.5.37, for debian-linux-gnu (x86_64)
|
2
|
+
--
|
3
|
+
-- Host: localhost Database: flydata_sync
|
4
|
+
-- ------------------------------------------------------
|
5
|
+
-- Server version 5.5.37-0ubuntu0.12.04.1-log
|
6
|
+
|
7
|
+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
8
|
+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
9
|
+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
10
|
+
/*!40101 SET NAMES utf8 */;
|
11
|
+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
12
|
+
/*!40103 SET TIME_ZONE='+00:00' */;
|
13
|
+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
14
|
+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
15
|
+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
16
|
+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
17
|
+
|
18
|
+
--
|
19
|
+
-- Table structure for table `zerofill_table`
|
20
|
+
--
|
21
|
+
|
22
|
+
DROP TABLE IF EXISTS `zerofill_table`;
|
23
|
+
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
24
|
+
/*!40101 SET character_set_client = utf8 */;
|
25
|
+
CREATE TABLE `zerofill_table` (
|
26
|
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
27
|
+
`value_int` int(10) unsigned zerofill DEFAULT NULL,
|
28
|
+
`value_float` float unsigned zerofill DEFAULT NULL,
|
29
|
+
`value_dec` decimal(10,2) unsigned zerofill DEFAULT NULL,
|
30
|
+
`value_double` double unsigned zerofill DEFAULT NULL,
|
31
|
+
`name` varchar(256) DEFAULT NULL,
|
32
|
+
`value_small_int` smallint(5) unsigned DEFAULT NULL,
|
33
|
+
PRIMARY KEY (`id`)
|
34
|
+
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
|
35
|
+
/*!40101 SET character_set_client = @saved_cs_client */;
|
36
|
+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
37
|
+
|
38
|
+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
39
|
+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
40
|
+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
41
|
+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
42
|
+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
43
|
+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
44
|
+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
45
|
+
|
46
|
+
-- Dump completed on 2014-06-26 20:57:42
|
47
|
+
|
@@ -32,6 +32,51 @@ describe RedshiftTableDef do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
context 'with medium blob column def' do
|
37
|
+
context 'when size exceeds max size' do
|
38
|
+
let(:column) { {:name=>"col_medium_blob", :type=>"varbinary(16777215)", :default=>nil} }
|
39
|
+
it do
|
40
|
+
expect(subject).to eq(' "col_medium_blob" varchar(65535) DEFAULT NULL')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'with unsigned column def' do
|
46
|
+
let(:column) { {:name=>"value_small_int", :type=>"int2(5) unsigned", :default=>nil} }
|
47
|
+
it do
|
48
|
+
expect(subject).to eq(' "value_small_int" int4 DEFAULT NULL')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'with decimal column def' do
|
53
|
+
context 'when precision exceeds max allowed' do
|
54
|
+
let(:column) { {:name=>"value", :type=>"numeric(65,30)", :default=>nil} }
|
55
|
+
it 'should replace precision with max value' do
|
56
|
+
expect(subject).to eq(' "value" numeric(38,30) DEFAULT NULL')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
context 'when scale exceeds max allowed' do #not possible
|
60
|
+
let(:column) { {:name=>"value", :type=>"numeric(45,44)", :default=>nil} }
|
61
|
+
it 'should replace scale with max value' do
|
62
|
+
expect(subject).to eq(' "value" numeric(38,37) DEFAULT NULL')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'when precision and scale exceeds max allowed (for unsigned)' do
|
67
|
+
let(:column) { {:name=>"value", :type=>"numeric(65,44) unsigned", :default=>nil} }
|
68
|
+
it 'should replace precision with max value' do
|
69
|
+
expect(subject).to eq(' "value" numeric(38,37) DEFAULT NULL')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'when precision and scale are within limit (for unsigned)' do
|
74
|
+
let(:column) { {:name=>"value", :type=>"numeric(37,29) unsigned", :default=>nil} }
|
75
|
+
it 'should do nothing' do
|
76
|
+
expect(subject).to eq(' "value" numeric(37,29) DEFAULT NULL')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
35
80
|
end
|
36
81
|
|
37
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flydata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -155,6 +155,22 @@ dependencies:
|
|
155
155
|
- - ~>
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: 0.3.11
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: slop
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
158
174
|
- !ruby/object:Gem::Dependency
|
159
175
|
name: bundler
|
160
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -370,6 +386,7 @@ files:
|
|
370
386
|
- spec/fluent_plugins_spec_helper.rb
|
371
387
|
- spec/fly_data_model_spec.rb
|
372
388
|
- spec/flydata/api/data_entry_spec.rb
|
389
|
+
- spec/flydata/cli_spec.rb
|
373
390
|
- spec/flydata/command/sender_spec.rb
|
374
391
|
- spec/flydata/command/sync_spec.rb
|
375
392
|
- spec/flydata/fluent-plugins/in_mysql_binlog_flydata_spec.rb
|
@@ -383,6 +400,7 @@ files:
|
|
383
400
|
- spec/flydata/table_def/mysqldump_test_table_enum.dump
|
384
401
|
- spec/flydata/table_def/mysqldump_test_table_multi_pk.dump
|
385
402
|
- spec/flydata/table_def/mysqldump_test_table_no_pk.dump
|
403
|
+
- spec/flydata/table_def/mysqldump_test_unsigned.dump
|
386
404
|
- spec/flydata/table_def/redshift_table_def_spec.rb
|
387
405
|
- spec/flydata/util/encryptor_spec.rb
|
388
406
|
- spec/flydata_spec.rb
|
@@ -403,7 +421,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
403
421
|
version: '0'
|
404
422
|
segments:
|
405
423
|
- 0
|
406
|
-
hash:
|
424
|
+
hash: 4366584009775605873
|
407
425
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
408
426
|
none: false
|
409
427
|
requirements:
|
@@ -412,7 +430,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
430
|
version: '0'
|
413
431
|
requirements: []
|
414
432
|
rubyforge_project:
|
415
|
-
rubygems_version: 1.8.
|
433
|
+
rubygems_version: 1.8.24
|
416
434
|
signing_key:
|
417
435
|
specification_version: 3
|
418
436
|
summary: FlyData CLI
|