multiwoven-integrations 0.35.2 → 0.35.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 296955c660631759f84e1e24f580a1259ccf8abf867284b0ed4099d7adcf0925
|
|
4
|
+
data.tar.gz: 6f53522bdd3ac2c13fd777db41fd565baee9774d04d5c8bc27369036c0c919ee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32039f417c9727aff7ef7fb402a75f57540ba0b539422ade8f10e9b09ca2f759bdcadea9726336380f0dac307862808a98a0773afe0e8756829e3f90702358c8
|
|
7
|
+
data.tar.gz: ef7e2d82a89c99aa839950503243adcc58f8e166d1d75adc575ecf0f34ded253add6a5255a6c4e1710061cef1a4e5488462a939e25253a2ea853acdb4a969c48
|
|
@@ -51,8 +51,8 @@ module Multiwoven::Integrations::Destination
|
|
|
51
51
|
connection_config = sync_config.destination.connection_specification.with_indifferent_access
|
|
52
52
|
raw_table = sync_config.stream.name
|
|
53
53
|
table_name = qualify_table(connection_config[:schema], raw_table)
|
|
54
|
-
primary_key = sync_config.model.primary_key
|
|
55
54
|
db = create_connection(connection_config)
|
|
55
|
+
primary_key = fetch_primary_key(db, connection_config[:schema], raw_table)
|
|
56
56
|
|
|
57
57
|
write_success = 0
|
|
58
58
|
write_failure = 0
|
|
@@ -181,6 +181,23 @@ module Multiwoven::Integrations::Destination
|
|
|
181
181
|
end
|
|
182
182
|
end
|
|
183
183
|
|
|
184
|
+
def fetch_primary_key(db, schema, table)
|
|
185
|
+
schema = schema.presence || "public"
|
|
186
|
+
quoted = "\"#{schema}\".\"#{table}\""
|
|
187
|
+
result = db.exec(<<~SQL)
|
|
188
|
+
SELECT a.attname AS column_name
|
|
189
|
+
FROM pg_index i
|
|
190
|
+
JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey)
|
|
191
|
+
WHERE i.indrelid = '#{quoted}'::regclass
|
|
192
|
+
AND i.indisprimary
|
|
193
|
+
LIMIT 1
|
|
194
|
+
SQL
|
|
195
|
+
result.first&.dig("column_name")
|
|
196
|
+
rescue StandardError => e
|
|
197
|
+
logger.warn("POSTGRESQL:FETCH_PRIMARY_KEY:EXCEPTION #{e.message}")
|
|
198
|
+
nil
|
|
199
|
+
end
|
|
200
|
+
|
|
184
201
|
def qualify_table(schema, table)
|
|
185
202
|
return table if schema.blank? || schema == "public"
|
|
186
203
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: multiwoven-integrations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.35.
|
|
4
|
+
version: 0.35.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Subin T P
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|