datapipe2 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/datapipe2.rb +1 -0
- data/lib/fns/db_to_db.rb +17 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50d3264229f3363592e873e03600b7830f205a46
|
4
|
+
data.tar.gz: d1226748e0b7892cb315b0082fe901ea397a14e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b444290a548ea22eefadb745da1fd8042f2d56bf020a894360cf04c29372ad71d893533fe22c965e16780948a9993fe6bcd11f3c3fa4e5bdb68c977c3b5577c
|
7
|
+
data.tar.gz: 8405a58c633c023750110419d10fd1bdd0cd2b9ffe86a769f2b48d075189ead6730663e5f040864766add4c2bb0f1d709c4fb5d2deb0ee7af41f35f2c80116f4
|
data/lib/datapipe2.rb
CHANGED
data/lib/fns/db_to_db.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
def db_to_db(select_sql, table_name, columns)
|
3
|
+
s = FluidDb::Db(ENV['SOURCE_DB']) # source
|
4
|
+
d = FluidDb::Db(ENV['DEST_DB']) # destination
|
5
|
+
|
6
|
+
insert_cmd = %{
|
7
|
+
INSERT INTO #{table_name} (#{columns})
|
8
|
+
VALUES (#{Array.new(columns.split(',').length, '?').join(',')})
|
9
|
+
}
|
10
|
+
|
11
|
+
rst = s.queryForResultset(select_sql)
|
12
|
+
rst.each do |row|
|
13
|
+
d.execute(insert_cmd, row.values)
|
14
|
+
end
|
15
|
+
|
16
|
+
DataPipe2.log "#{table_name}: #{rst.length}"
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datapipe2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Irvine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: zero to one for moving data
|
14
14
|
email: guy@guyirvine.com
|
@@ -20,6 +20,7 @@ files:
|
|
20
20
|
- lib/datapipe2.rb
|
21
21
|
- lib/fns/csv_to_db.rb
|
22
22
|
- lib/fns/db_to_csv.rb
|
23
|
+
- lib/fns/db_to_db.rb
|
23
24
|
- lib/fns/db_to_json.rb
|
24
25
|
- lib/fns/mssql_to_pgsql.rb
|
25
26
|
- lib/fns/smb_to_local.rb
|