multiwoven-integrations 0.35.2 → 0.35.4

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: 2c6bf44e44a29c0ee851e748acf3ce7adf10495e413caaa6a5fa233155841abf
4
- data.tar.gz: 50c9d53c1010c4656010e29a708b38be7c990ea81395ef85d3519998de68d03a
3
+ metadata.gz: f03f909a2b711e29b6c9adb5ce81c3b5bcb12653d633c7dbd5cc7828ffce4121
4
+ data.tar.gz: b244b5a203346665be128a7b24b0d82cd7431ed4480cb90059351489c97e1d02
5
5
  SHA512:
6
- metadata.gz: 4fb43e2a451ab824e9318fb94878eb2059f7cb0756ced03d37371b35b7c7ab0699574dba9b6ede033321e4082a295169ac074f94463e32ed4ed32e1123f8b856
7
- data.tar.gz: 5c4c85224e29eec00ccf32c0be81ecc1cb97c2f58d06b33b3220c0ab79a7ccbd78e2eea8ad102fa7d67879873e1c1ff218932aba37ab08b2e72fd1bef6b0c21b
6
+ metadata.gz: 61deca83fc498fc44c3d31b6fdbd5e68863dfdebc7449046bfe39d84ebf9ca49aeb4623bab3c4438130fb701d6286bd8f9832e32d7e1bc670509685ebe802b1e
7
+ data.tar.gz: 5a1b1c6060ee16c5e6ee552c4eb63a9cdecf3d229d5e7dfb1f04b0117769d8b75925f23b3c210a220d6c5456e96243ce4197be17a3e8e336070c799479dce866
@@ -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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.35.2"
5
+ VERSION = "0.35.4"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
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.2
4
+ version: 0.35.4
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-03 00:00:00.000000000 Z
11
+ date: 2026-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport