active_data_frame 0.1.9 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +21 -0
- data/active_data_frame.gemspec +5 -5
- data/lib/active_data_frame/data_frame_proxy.rb +2 -2
- data/lib/active_data_frame/database.rb +5 -5
- data/lib/active_data_frame/row.rb +2 -2
- data/lib/active_data_frame/table.rb +1 -1
- data/lib/active_data_frame/version.rb +1 -1
- metadata +17 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4dc73f14e73f597961f8b8092c29090dd962efe8f8d5adc1f5e4550fbd3c4d57
|
4
|
+
data.tar.gz: e6c9e266e39898c063f7e0c02b94856970c64f73e80fbacccfca924b259562e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aa335d4cd4f887212b9ee3e46a96ab172d682af1f35380bcc51f160b1938faa21f82472d7baad0c49f2c49477b8567a2e8c45b5a50cc8f11be8673a60495982
|
7
|
+
data.tar.gz: dd246279e53dbb9d41e9894c842c1b62f8d4f7c2e724f7db2ca058983d22c25ecf4c1e24fa13d4fa3582e4fa8f92a4466facdbeaee52f238146f891ec2c4227d
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 Wouter Coppieters
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/active_data_frame.gemspec
CHANGED
@@ -20,16 +20,16 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency 'pry'
|
23
|
+
spec.add_development_dependency 'bundler', '~> 2.4'
|
24
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
25
|
+
spec.add_development_dependency 'pry-byebug'
|
26
|
+
spec.add_development_dependency 'pry'
|
27
27
|
spec.add_development_dependency 'pg'
|
28
28
|
spec.add_development_dependency 'sqlite3'
|
29
29
|
spec.add_development_dependency 'mysql2'
|
30
30
|
spec.add_development_dependency 'minitest', '~>5.11'
|
31
31
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1', '>= 1.1.0'
|
32
32
|
spec.add_development_dependency 'minitest-around', '0.4.1'
|
33
|
-
spec.add_runtime_dependency 'activerecord', '~>
|
33
|
+
spec.add_runtime_dependency 'activerecord', '~> 7.0'
|
34
34
|
spec.add_runtime_dependency 'rmatrix', '~> 0.1.20', '>=0.1.20'
|
35
35
|
end
|
@@ -76,7 +76,7 @@ module ActiveDataFrame
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def method_missing(name, *args, &block)
|
79
|
-
if name.to_s.
|
79
|
+
if name.to_s.end_with?(?=)
|
80
80
|
is_assignment = true
|
81
81
|
name = name.to_s.gsub(/=$/,'').to_sym
|
82
82
|
end
|
@@ -92,7 +92,7 @@ module ActiveDataFrame
|
|
92
92
|
ranges.map do |range|
|
93
93
|
case range
|
94
94
|
when Range then range
|
95
|
-
when
|
95
|
+
when Integer then range..range
|
96
96
|
else raise "Unexpected index for data frame proxy #{range}, expecting either a Range or an Integer"
|
97
97
|
end
|
98
98
|
end
|
@@ -16,7 +16,7 @@ module ActiveDataFrame
|
|
16
16
|
unless sql.empty?
|
17
17
|
ActiveRecord::Base.transaction do
|
18
18
|
ActiveDataFrame::DataFrameProxy.suppress_logs do
|
19
|
-
case ActiveRecord::Base.
|
19
|
+
case ActiveRecord::Base.connection_db_config.adapter
|
20
20
|
when 'sqlite3'.freeze
|
21
21
|
ActiveRecord::Base.connection.raw_connection.execute_batch sql
|
22
22
|
when 'mysql2'
|
@@ -61,7 +61,7 @@ module ActiveDataFrame
|
|
61
61
|
|
62
62
|
def bulk_upsert(upserts, scope=nil)
|
63
63
|
Database.batch do
|
64
|
-
case ActiveRecord::Base.
|
64
|
+
case ActiveRecord::Base.connection_db_config.adapter
|
65
65
|
when 'postgresql'.freeze
|
66
66
|
upserts.group_by(&:keys).each do |columns, value_list|
|
67
67
|
columns = columns - [:data_frame_id, :period_index]
|
@@ -108,7 +108,7 @@ module ActiveDataFrame
|
|
108
108
|
def bulk_update(existing, columns=block_type::COLUMNS)
|
109
109
|
existing.each_slice(ActiveDataFrame.update_max_batch_size) do |existing_slice|
|
110
110
|
# puts "Updating slice of #{existing_slice.length}"
|
111
|
-
case ActiveRecord::Base.
|
111
|
+
case ActiveRecord::Base.connection_db_config.adapter
|
112
112
|
when 'postgresql'.freeze
|
113
113
|
#
|
114
114
|
# PostgreSQL Supports the fast setting of multiple update values that differ
|
@@ -188,7 +188,7 @@ module ActiveDataFrame
|
|
188
188
|
##
|
189
189
|
def bulk_insert(new_blocks, columns=block_type::COLUMNS)
|
190
190
|
new_blocks.each_slice(ActiveDataFrame.insert_max_batch_size) do |new_blocks_slice|
|
191
|
-
if ActiveRecord::Base.
|
191
|
+
if ActiveRecord::Base.connection_db_config.adapter == 'postgresql'
|
192
192
|
copy_statement = "COPY #{block_type.table_name} (#{columns.join(',')},data_frame_id,period_index,data_frame_type) FROM STDIN CSV"
|
193
193
|
db_conn = ActiveRecord::Base.connection.raw_connection
|
194
194
|
db_conn.copy_data(copy_statement) do
|
@@ -200,7 +200,7 @@ module ActiveDataFrame
|
|
200
200
|
inserts = ''
|
201
201
|
new_blocks_slice.each do |period_index, (values, df_id)|
|
202
202
|
inserts << \
|
203
|
-
case ActiveRecord::Base.
|
203
|
+
case ActiveRecord::Base.connection_db_config.adapter
|
204
204
|
when 'mysql2' then "(#{values.map{|v| v.inspect.gsub('"',"'") }.join(',')}, #{df_id}, #{period_index}, '#{data_frame_type.name}'),"
|
205
205
|
else "(#{values.map{|v| v.inspect.gsub('"',"'") }.join(',')}, #{df_id}, #{period_index}, '#{data_frame_type.name}'),"
|
206
206
|
end
|
@@ -13,7 +13,7 @@ module ActiveDataFrame
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.set_all(scope, block_type, data_frame_type, from, values, trim: false)
|
16
|
-
if trim || ActiveRecord::Base.
|
16
|
+
if trim || ActiveRecord::Base.connection_db_config.adapter === 'mysql2'
|
17
17
|
case values
|
18
18
|
when Hash then scope.where(id: values.keys)
|
19
19
|
.each{|instance| Row.new(block_type, data_frame_type, instance)
|
@@ -45,7 +45,7 @@ module ActiveDataFrame
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def set(from, values, trim: false)
|
48
|
-
if trim || ActiveRecord::Base.
|
48
|
+
if trim || ActiveRecord::Base.connection_db_config.adapter === 'mysql2'
|
49
49
|
patch(from, values)
|
50
50
|
else
|
51
51
|
upsert(from, values)
|
@@ -104,7 +104,7 @@ module ActiveDataFrame
|
|
104
104
|
ActiveRecord::Base.connection.execute(as_sql)
|
105
105
|
end
|
106
106
|
|
107
|
-
case ActiveRecord::Base.
|
107
|
+
case ActiveRecord::Base.connection_db_config.adapter
|
108
108
|
when 'postgresql'.freeze
|
109
109
|
res.each_row {|pi, data_frame_id, *values| existing_blocks[pi][data_frame_id] = values }
|
110
110
|
when 'mysql2'.freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_data_frame
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wouter Coppieters
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,68 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.4'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry-byebug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 3.4.0
|
48
45
|
- - ">="
|
49
46
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
47
|
+
version: '0'
|
51
48
|
type: :development
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
|
-
- - "~>"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 3.4.0
|
58
52
|
- - ">="
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
54
|
+
version: '0'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: pry
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
|
-
- - "~>"
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 0.10.2
|
68
59
|
- - ">="
|
69
60
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0
|
61
|
+
version: '0'
|
71
62
|
type: :development
|
72
63
|
prerelease: false
|
73
64
|
version_requirements: !ruby/object:Gem::Requirement
|
74
65
|
requirements:
|
75
|
-
- - "~>"
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 0.10.2
|
78
66
|
- - ">="
|
79
67
|
- !ruby/object:Gem::Version
|
80
|
-
version: 0
|
68
|
+
version: '0'
|
81
69
|
- !ruby/object:Gem::Dependency
|
82
70
|
name: pg
|
83
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,14 +162,14 @@ dependencies:
|
|
174
162
|
requirements:
|
175
163
|
- - "~>"
|
176
164
|
- !ruby/object:Gem::Version
|
177
|
-
version: '
|
165
|
+
version: '7.0'
|
178
166
|
type: :runtime
|
179
167
|
prerelease: false
|
180
168
|
version_requirements: !ruby/object:Gem::Requirement
|
181
169
|
requirements:
|
182
170
|
- - "~>"
|
183
171
|
- !ruby/object:Gem::Version
|
184
|
-
version: '
|
172
|
+
version: '7.0'
|
185
173
|
- !ruby/object:Gem::Dependency
|
186
174
|
name: rmatrix
|
187
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,6 +200,7 @@ files:
|
|
212
200
|
- ".gitignore"
|
213
201
|
- CODE_OF_CONDUCT.md
|
214
202
|
- Gemfile
|
203
|
+
- LICENSE
|
215
204
|
- README.md
|
216
205
|
- Rakefile
|
217
206
|
- active_data_frame-0.1.1.gem
|
@@ -237,7 +226,7 @@ files:
|
|
237
226
|
homepage: https://github.com/wouterken/active_data_frame
|
238
227
|
licenses: []
|
239
228
|
metadata: {}
|
240
|
-
post_install_message:
|
229
|
+
post_install_message:
|
241
230
|
rdoc_options: []
|
242
231
|
require_paths:
|
243
232
|
- lib
|
@@ -252,9 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
241
|
- !ruby/object:Gem::Version
|
253
242
|
version: '0'
|
254
243
|
requirements: []
|
255
|
-
|
256
|
-
|
257
|
-
signing_key:
|
244
|
+
rubygems_version: 3.4.6
|
245
|
+
signing_key:
|
258
246
|
specification_version: 4
|
259
247
|
summary: An active data frame helper
|
260
248
|
test_files: []
|