tapsoob 0.4.23-java → 0.4.26-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8d6fce8a1a4f85f3400a93624b455db3a640a68b5f03b1b87ffe0d17b2ddd82
4
- data.tar.gz: 77d96d95817b4267c68329a6cec5f55c8810265572c117c6088762edbec97db8
3
+ metadata.gz: 8e3cbb277f5cdce47dedb68f56ac4122c47e44fa3b3206c6a319c35e86958781
4
+ data.tar.gz: bd35fe8afb0c23aaf477ea253fd3caee584bc2d889ab44edbd0e06531a657e73
5
5
  SHA512:
6
- metadata.gz: 29a06e8d1f6232f923c5d5eb7c27ecb874a66c14d3e7bf742518c71d568b90ac59794cf8f0478812421ea7f7a1994f05826457026ad3194261411eda19c7c41c
7
- data.tar.gz: 917d3ffdde7941513eae57de66dcd9793b3bd9ca67889bfb84c1897484067d4ceb6c126adbbbe7af343f906cbb67ff13f7496e386a3cecf9fd25ede151f19228
6
+ metadata.gz: 7810d544770e15e4ed266f367f6e5f9477df1909122ec02c9c542d59cad422cdb80bd789286a21a4109634562f41159a5b4723bb45b129f6ff44ee4d770a2b7f
7
+ data.tar.gz: ad0409458ec17dfc37d274a8fa4245c16cc242e77423407bd46eb6c1dd62bfa625041b7d6fef4603052baea5f47849c9ba2f8a41bd058dcfe9c6e0283ede6086
@@ -12,7 +12,6 @@ module Tapsoob
12
12
  class DataStream < Thor
13
13
  desc "pull DATABASE_URL [DUMP_PATH]", "Pull data from a database."
14
14
  option :chunksize, desc: "Initial chunksize", default: 1000, type: :numeric, aliases: "-c"
15
- option :filter, desc: "Regex Filter for tables", type: :string, aliases: "-f"
16
15
  option :tables, desc: "Shortcut to filter on a list of tables", type: :array, aliases: "-t"
17
16
  option :"exclude-tables", desc: "Shortcut to exclude a list of tables", type: :array, aliases: "-e"
18
17
  option :progress, desc: "Show progress", default: true, type: :boolean, aliases: "-p"
@@ -24,7 +23,6 @@ module Tapsoob
24
23
 
25
24
  desc "push DATABASE_URL [DUMP_PATH]", "Push data to a database."
26
25
  option :chunksize, desc: "Initial chunksize", default: 1000, type: :numeric, aliases: "-c"
27
- option :filter, desc: "Regex Filter for tables", type: :string, aliases: "-f"
28
26
  option :tables, desc: "Shortcut to filter on a list of tables", type: :array, aliases: "-t"
29
27
  option :"exclude-tables", desc: "Shortcut to exclude a list of tables", type: :array, aliases: "-e"
30
28
  option :progress, desc: "Show progress", default: true, type: :boolean, aliases: "-p"
@@ -65,6 +63,7 @@ module Tapsoob
65
63
  # Default options
66
64
  opts = {
67
65
  progress: options[:progress],
66
+ tables: options[:tables],
68
67
  debug: options[:debug]
69
68
  }
70
69
 
@@ -78,15 +77,6 @@ module Tapsoob
78
77
  opts[:default_chunksize] = (options[:chunksize] < 10 ? 10 : options[:chunksize])
79
78
  end
80
79
 
81
- # Regex filter
82
- opts[:table_filter] = options[:filter] if options[:filter]
83
-
84
- # Table filter
85
- if options[:tables]
86
- r_tables = options[:tables].collect { |t| "^#{t}" }.join("|")
87
- opts[:table_filter] = "#{r_tables}"
88
- end
89
-
90
80
  # Exclude tables
91
81
  opts[:exclude_tables] = options[:"exclude-tables"] if options[:"exclude-tables"]
92
82
 
@@ -15,7 +15,6 @@ module Tapsoob
15
15
  option :resume, desc: "Resume a Tapsoob Session from a stored file", type: :string, aliases: "-r"
16
16
  option :chunksize, desc: "Initial chunksize", default: 1000, type: :numeric, aliases: "-c"
17
17
  option :"disable-compression", desc: "Disable Compression", default: false, type: :boolean, aliases: "-g"
18
- option :filter, desc: "Regex Filter for tables", type: :string, aliases: "-f"
19
18
  option :tables, desc: "Shortcut to filter on a list of tables", type: :array, aliases: "-t"
20
19
  option :"exclude-tables", desc: "Shortcut to exclude a list of tables", type: :array, aliases: "-e"
21
20
  option :debug, desc: "Enable debug messages", default: false, type: :boolean, aliases: "-d"
@@ -35,7 +34,6 @@ module Tapsoob
35
34
  option :resume, desc: "Resume a Tapsoob Session from a stored file", type: :string, aliases: "-r"
36
35
  option :chunksize, desc: "Initial chunksize", default: 1000, type: :numeric, aliases: "-c"
37
36
  option :"disable-compression", desc: "Disable Compression", default: false, type: :boolean, aliases: "-g"
38
- option :filter, desc: "Regex Filter for tables", type: :string, aliases: "-f"
39
37
  option :tables, desc: "Shortcut to filter on a list of tables", type: :array, aliases: "-t"
40
38
  option :"exclude-tables", desc: "Shortcut to exclude a list of tables", type: :array, aliases: "-e"
41
39
  option :purge, desc: "Purge data in tables prior to performing the import", default: false, type: :boolean, aliases: "-p"
@@ -70,6 +68,7 @@ module Tapsoob
70
68
  skip_schema: options[:"skip-schema"],
71
69
  indexes_first: options[:"indexes_first"],
72
70
  disable_compression: options[:"disable-compression"],
71
+ tables: options[:tables],
73
72
  debug: options[:debug]
74
73
  }
75
74
 
@@ -92,15 +91,6 @@ module Tapsoob
92
91
  opts[:default_chunksize] = (options[:chunksize] < 10 ? 10 : options[:chunksize])
93
92
  end
94
93
 
95
- # Regex filter
96
- opts[:table_filter] = options[:filter] if options[:filter]
97
-
98
- # Table filter
99
- if options[:tables]
100
- r_tables = options[:tables].collect { |t| "^#{t}" }.join("|")
101
- opts[:table_filter] = "#{r_tables}"
102
- end
103
-
104
94
  # Exclude tables
105
95
  opts[:exclude_tables] = options[:"exclude-tables"] if options[:"exclude-tables"]
106
96
 
@@ -30,7 +30,7 @@ module Tapsoob
30
30
  end
31
31
 
32
32
  def table_filter
33
- opts[:table_filter]
33
+ opts[:tables] || []
34
34
  end
35
35
 
36
36
  def exclude_tables
@@ -38,19 +38,18 @@ module Tapsoob
38
38
  end
39
39
 
40
40
  def apply_table_filter(tables)
41
- return tables unless table_filter || exclude_tables
41
+ return tables if table_filter.empty? && exclude_tables.empty?
42
42
 
43
- re = table_filter ? Regexp.new(table_filter) : nil
44
43
  if tables.kind_of?(Hash)
45
44
  ntables = {}
46
45
  tables.each do |t, d|
47
- if !exclude_tables.include?(t.to_s) && (!re || !re.match(t.to_s).nil?)
46
+ if !exclude_tables.include?(t.to_s) && (!table_filter.empty? && table_filter.include?(t.to_s))
48
47
  ntables[t] = d
49
48
  end
50
49
  end
51
50
  ntables
52
51
  else
53
- tables.reject { |t| exclude_tables.include?(t.to_s) || (re && re.match(t.to_s).nil?) }
52
+ tables.reject { |t| exclude_tables.include?(t.to_s) }.select { |t| table_filter.include?(t.to_s) }
54
53
  end
55
54
  end
56
55
 
@@ -182,7 +181,7 @@ module Tapsoob
182
181
  schema_data = Tapsoob::Schema.dump_table(database_url, table_name)
183
182
  log.debug "Table: #{table_name}\n#{schema_data}\n"
184
183
  output = Tapsoob::Utils.export_schema(dump_path, table_name, schema_data)
185
- puts output if output
184
+ puts output if dump_path.nil? && output
186
185
  progress.inc(1)
187
186
  end
188
187
  progress.finish
@@ -290,7 +289,7 @@ module Tapsoob
290
289
  def pull_indexes
291
290
  log.info "Receiving indexes"
292
291
 
293
- raw_idxs = Tapsoob::Utils.schema_bin(:indexes_individual, database_url)
292
+ raw_idxs = Tapsoob::Schema.indexes_individual(database_url)
294
293
  idxs = (raw_idxs && raw_idxs.length >= 2 ? JSON.parse(raw_idxs) : {})
295
294
 
296
295
  apply_table_filter(idxs).each do |table, indexes|
@@ -298,7 +297,7 @@ module Tapsoob
298
297
  progress = ProgressBar.new(table, indexes.size)
299
298
  indexes.each do |idx|
300
299
  output = Tapsoob::Utils.export_indexes(dump_path, table, idx)
301
- puts output if output
300
+ puts output if dump_path.nil? && output
302
301
  progress.inc(1)
303
302
  end
304
303
  progress.finish
@@ -309,7 +308,7 @@ module Tapsoob
309
308
  log.info "Resetting sequences"
310
309
 
311
310
  output = Tapsoob::Utils.schema_bin(:reset_db_sequences, database_url)
312
- puts output if output
311
+ puts output if dump_path.nil? && output
313
312
  end
314
313
  end
315
314
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Tapsoob
3
- VERSION = "0.4.23".freeze
3
+ VERSION = "0.4.26".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapsoob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.23
4
+ version: 0.4.26
5
5
  platform: java
6
6
  authors:
7
7
  - Félix Bellanger
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-10-20 00:00:00.000000000 Z
12
+ date: 2022-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement