pgsync 0.7.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/LICENSE.txt +1 -1
- data/README.md +13 -3
- data/lib/pgsync/data_source.rb +1 -1
- data/lib/pgsync/task.rb +1 -1
- data/lib/pgsync/task_resolver.rb +2 -2
- data/lib/pgsync/version.rb +1 -1
- data/lib/pgsync.rb +12 -12
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a7083c722bb2060be572cc9e63911678b17063826fee239de9569f6eb9eb6e3
|
4
|
+
data.tar.gz: 1953d0434c070d3123e15d2e25fa5a5a74981a298da08ae39d7bc57c7f2ea00b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 363586792548ac9e856382c241292e6645b32421acad8dd18e240c095b89ea9fc5bd8a925cc57b2d9cbecca436b6899aa1396aac27cc71876bbf27028e074b06
|
7
|
+
data.tar.gz: 6ac5b582f9891428059106d0d40b3e7ddf3bac8442bd92aebb0cd2eff0bda99984ffcb16bd2df5ba6aacdacb58c89bbd0cd7f0d77d1bc59d2dc562c3a9630531
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Sync data from one Postgres database to another (like `pg_dump`/`pg_restore`). D
|
|
9
9
|
|
10
10
|
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
|
11
11
|
|
12
|
-
[![Build Status](https://github.com/ankane/pgsync/workflows/build/badge.svg
|
12
|
+
[![Build Status](https://github.com/ankane/pgsync/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/pgsync/actions)
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
@@ -143,7 +143,7 @@ pgsync product:123
|
|
143
143
|
|
144
144
|
## Schema
|
145
145
|
|
146
|
-
Sync schema before the data (this wipes out existing data)
|
146
|
+
Sync the schema before the data (this wipes out existing data)
|
147
147
|
|
148
148
|
```sh
|
149
149
|
pgsync --schema-first
|
@@ -155,7 +155,7 @@ Specify tables
|
|
155
155
|
pgsync table1,table2 --schema-first
|
156
156
|
```
|
157
157
|
|
158
|
-
|
158
|
+
Sync the schema without data (this wipes out existing data)
|
159
159
|
|
160
160
|
```sh
|
161
161
|
pgsync --schema-only
|
@@ -236,6 +236,14 @@ Disable user triggers with:
|
|
236
236
|
pgsync --disable-user-triggers
|
237
237
|
```
|
238
238
|
|
239
|
+
## Sequences
|
240
|
+
|
241
|
+
Skip syncing sequences with:
|
242
|
+
|
243
|
+
```sh
|
244
|
+
pgsync --no-sequences
|
245
|
+
```
|
246
|
+
|
239
247
|
## Append-Only Tables
|
240
248
|
|
241
249
|
For extremely large, append-only tables, sync in batches.
|
@@ -244,6 +252,8 @@ For extremely large, append-only tables, sync in batches.
|
|
244
252
|
pgsync large_table --in-batches
|
245
253
|
```
|
246
254
|
|
255
|
+
Note: This requires the table to have a numeric, increasing primary key
|
256
|
+
|
247
257
|
The script will resume where it left off when run again, making it great for backfills.
|
248
258
|
|
249
259
|
## Connection Security
|
data/lib/pgsync/data_source.rb
CHANGED
data/lib/pgsync/task.rb
CHANGED
@@ -229,7 +229,7 @@ module PgSync
|
|
229
229
|
|
230
230
|
# TODO better performance
|
231
231
|
def rule_match?(table, column, rule)
|
232
|
-
regex = Regexp.new('\A' + Regexp.escape(rule).gsub('\*','[^\.]*') + '\z')
|
232
|
+
regex = Regexp.new('\A' + Regexp.escape(rule).gsub('\*', '[^\.]*') + '\z')
|
233
233
|
regex.match(column) || regex.match("#{table.name}.#{column}") || regex.match("#{table.schema}.#{table.name}.#{column}")
|
234
234
|
end
|
235
235
|
|
data/lib/pgsync/task_resolver.rb
CHANGED
@@ -72,7 +72,7 @@ module PgSync
|
|
72
72
|
|
73
73
|
tables =
|
74
74
|
if value.include?("*")
|
75
|
-
regex = Regexp.new('\A' + Regexp.escape(value).gsub('\*','[^\.]*') + '\z')
|
75
|
+
regex = Regexp.new('\A' + Regexp.escape(value).gsub('\*', '[^\.]*') + '\z')
|
76
76
|
shared_tables.select { |t| regex.match(t.full_name) || regex.match(t.name) }
|
77
77
|
else
|
78
78
|
[to_table(value)]
|
@@ -145,7 +145,7 @@ module PgSync
|
|
145
145
|
|
146
146
|
to_arr(opts[:exclude]).each do |value|
|
147
147
|
if value.include?("*")
|
148
|
-
regex = Regexp.new('\A' + Regexp.escape(value).gsub('\*','[^\.]*') + '\z')
|
148
|
+
regex = Regexp.new('\A' + Regexp.escape(value).gsub('\*', '[^\.]*') + '\z')
|
149
149
|
tables.reject! { |t| regex.match(t.full_name) || regex.match(t.name) }
|
150
150
|
else
|
151
151
|
tables -= [fully_resolve(to_table(value), error: false)].compact
|
data/lib/pgsync/version.rb
CHANGED
data/lib/pgsync.rb
CHANGED
@@ -13,18 +13,18 @@ require "uri"
|
|
13
13
|
require "yaml"
|
14
14
|
|
15
15
|
# modules
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
require_relative "pgsync/utils"
|
17
|
+
require_relative "pgsync/client"
|
18
|
+
require_relative "pgsync/data_source"
|
19
|
+
require_relative "pgsync/init"
|
20
|
+
require_relative "pgsync/schema_sync"
|
21
|
+
require_relative "pgsync/sequence"
|
22
|
+
require_relative "pgsync/sync"
|
23
|
+
require_relative "pgsync/table"
|
24
|
+
require_relative "pgsync/table_sync"
|
25
|
+
require_relative "pgsync/task"
|
26
|
+
require_relative "pgsync/task_resolver"
|
27
|
+
require_relative "pgsync/version"
|
28
28
|
|
29
29
|
module PgSync
|
30
30
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgsync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bigdecimal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: parallel
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +58,14 @@ dependencies:
|
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
61
|
+
version: 4.10.1
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
68
|
+
version: 4.10.1
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: tty-spinner
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,14 +117,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
117
|
requirements:
|
104
118
|
- - ">="
|
105
119
|
- !ruby/object:Gem::Version
|
106
|
-
version: '2.
|
120
|
+
version: '2.7'
|
107
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
122
|
requirements:
|
109
123
|
- - ">="
|
110
124
|
- !ruby/object:Gem::Version
|
111
125
|
version: '0'
|
112
126
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
127
|
+
rubygems_version: 3.5.11
|
114
128
|
signing_key:
|
115
129
|
specification_version: 4
|
116
130
|
summary: Sync Postgres data between databases
|