data-anonymization 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/README.md +3 -0
- data/data-anonymization.gemspec +2 -2
- data/lib/strategy/base.rb +6 -4
- data/lib/utils/database.rb +11 -8
- data/lib/version.rb +1 -1
- data/spec/acceptance/rdbms_whitelist_spec.rb +23 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 796e8e4ec064ab6777e4bdd05e33a8dd0e3b2bd4
|
4
|
+
data.tar.gz: 6cb7c3f04d5686db81ff1d49b198ac4c14829d8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c60fc5490fc788c83d532848b163aa7bbf66d6c33e1d7dc5a94ca5da1c2ef0270fc89b13870141b4f01b6f5bf9cae11931ada0ca89bdc0fb03bf42604849af1
|
7
|
+
data.tar.gz: a223340e8f64df4687eb91d22dd261b6e601fb262c82df07f4adc4c46f93713bc08e90db21ccc475b29160b6bc71072ba86743a0c88fc8521519a4627d660b86
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -70,6 +70,9 @@ Postgresql database having **composite primary key**
|
|
70
70
|
|
71
71
|
## Changelog
|
72
72
|
|
73
|
+
#### 0.7.3 (Feb 5, 2016)
|
74
|
+
1. Fixed issue with batchsize. Thanks to [Jan Raasch](https://github.com/janraasch) for sending pull request.
|
75
|
+
|
73
76
|
#### 0.7.2 (Sep 26, 2015)
|
74
77
|
1. Upgraded MongoDB to latest gem version 2.1.0 and tested with MongoDB 3.x version.
|
75
78
|
2. Upgraded gems to latest version
|
data/data-anonymization.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = DataAnonymization::VERSION
|
9
9
|
gem.authors = ['Sunit Parekh', 'Anand Agrawal', 'Satyam Agarwala']
|
10
10
|
gem.email = %w(parekh.sunit@gmail.com anand.agrawal84@gmail.com satyamag@gmail.com)
|
11
|
-
gem.description = %q{Data anonymization tool for RDBMS databases}
|
12
|
-
gem.summary = %q{Tool to create anonymized production data dump to use for
|
11
|
+
gem.description = %q{Data anonymization tool for RDBMS and MongoDB databases}
|
12
|
+
gem.summary = %q{Tool to create anonymized production data dump to use for performance and testing environments.}
|
13
13
|
gem.homepage = 'http://sunitparekh.github.com/data-anonymization'
|
14
14
|
gem.license = 'MIT'
|
15
15
|
|
data/lib/strategy/base.rb
CHANGED
@@ -76,14 +76,16 @@ module DataAnon
|
|
76
76
|
|
77
77
|
def dest_table
|
78
78
|
return @dest_table unless @dest_table.nil?
|
79
|
-
|
80
|
-
|
79
|
+
table_klass = Utils::DestinationTable.create @name, @primary_keys
|
80
|
+
table_klass.establish_connection @destination_database if @destination_database
|
81
|
+
@dest_table = table_klass
|
81
82
|
end
|
82
83
|
|
83
84
|
def source_table
|
84
85
|
return @source_table unless @source_table.nil?
|
85
|
-
|
86
|
-
|
86
|
+
table_klass = Utils::SourceTable.create @name, @primary_keys
|
87
|
+
table_klass.establish_connection @source_database
|
88
|
+
@source_table = table_klass
|
87
89
|
end
|
88
90
|
|
89
91
|
def process
|
data/lib/utils/database.rb
CHANGED
@@ -30,14 +30,17 @@ module DataAnon
|
|
30
30
|
class BaseTable
|
31
31
|
|
32
32
|
def self.create_table database, table_name, primary_keys = []
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
klass_name = table_name.to_s.downcase.capitalize
|
34
|
+
return database.const_get klass_name if database.const_defined? klass_name
|
35
|
+
database.const_set(klass_name, Class.new(database) do
|
36
|
+
self.table_name = table_name
|
37
|
+
self.primary_keys = primary_keys if primary_keys.length > 1
|
38
|
+
self.primary_key = primary_keys[0] if primary_keys.length == 1
|
39
|
+
self.primary_key = nil if primary_keys.length == 0
|
40
|
+
self.inheritance_column = :_type_disabled
|
41
|
+
self.mass_assignment_sanitizer = MassAssignmentIgnoreSanitizer.new
|
42
|
+
end
|
43
|
+
)
|
41
44
|
end
|
42
45
|
|
43
46
|
end
|
data/lib/version.rb
CHANGED
@@ -53,6 +53,29 @@ describe 'End 2 End RDBMS Whitelist Acceptance Test using SQLite database' do
|
|
53
53
|
new_rec.updated_at.should == Time.new(2010,5,5)
|
54
54
|
end
|
55
55
|
|
56
|
+
describe 'batch_size' do
|
57
|
+
it 'processes all records in batches' do
|
58
|
+
database 'Customer' do
|
59
|
+
strategy DataAnon::Strategy::Whitelist
|
60
|
+
source_db source_connection_spec
|
61
|
+
destination_db dest_connection_spec
|
62
|
+
|
63
|
+
table 'customers' do
|
64
|
+
batch_size 1
|
65
|
+
whitelist 'first_name'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
DataAnon::Utils::DestinationDatabase.establish_connection dest_connection_spec
|
70
|
+
dest_table = DataAnon::Utils::DestinationTable.create 'customers'
|
71
|
+
dest_table.count.should == 2
|
72
|
+
first_rec = dest_table.first
|
73
|
+
first_rec.first_name.should eq('Sunit')
|
74
|
+
second_rec = dest_table.second
|
75
|
+
second_rec.first_name.should eq('Rohit')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
56
79
|
describe 'limiting' do
|
57
80
|
it 'returns only last record' do
|
58
81
|
database 'Customer' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data-anonymization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunit Parekh
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
- - "~>"
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0.19'
|
141
|
-
description: Data anonymization tool for RDBMS databases
|
141
|
+
description: Data anonymization tool for RDBMS and MongoDB databases
|
142
142
|
email:
|
143
143
|
- parekh.sunit@gmail.com
|
144
144
|
- anand.agrawal84@gmail.com
|
@@ -311,11 +311,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
311
311
|
version: '0'
|
312
312
|
requirements: []
|
313
313
|
rubyforge_project:
|
314
|
-
rubygems_version: 2.
|
314
|
+
rubygems_version: 2.5.1
|
315
315
|
signing_key:
|
316
316
|
specification_version: 4
|
317
|
-
summary: Tool to create anonymized production data dump to use for
|
318
|
-
|
317
|
+
summary: Tool to create anonymized production data dump to use for performance and
|
318
|
+
testing environments.
|
319
319
|
test_files:
|
320
320
|
- spec/acceptance/mongodb_blacklist_spec.rb
|
321
321
|
- spec/acceptance/mongodb_whitelist_spec.rb
|