multiwoven-integrations 0.1.13 → 0.1.14

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: 823511ceb667f340a6a98cf55c054e7926060f259ae02ac9bd64e2667ce24dbf
4
- data.tar.gz: a6f2e9a533ab1f2ffecc8c40b7078a182296dad452d30968c6d6bc8de10304bc
3
+ metadata.gz: b39ab365030240bd8a86273bf11ba5a583c033b794fd355229a26c9e2e18cb08
4
+ data.tar.gz: 3ebfe60a941654753b9e6874a722d77c43d3def2b91dcccbbf4e58d8d343fbd8
5
5
  SHA512:
6
- metadata.gz: 9feabb2d1de4402f301a6d2fa1d021973d17bf3d7b262dddd7a18e8a2136de5bba9aeb48247647a5ba698bfc4784ad1b01351042168900ea0b28b76f0696578e
7
- data.tar.gz: c114097c52b34c42307c7f1590b23321d21fbc0c9bbb429ee06b17b25dbf31649d522b2753e61c04ce82d81d2b79ea06428058e1dc144c91babad8007c7b560e
6
+ metadata.gz: ae5e08fedccad34910479b98eff4cde85c0626f9d98cca4b221f6eb5e2d1b982271013c03d13d8fd6bd4ae88ac7bd19090b684c547830de6016e270340ed0d00
7
+ data.tar.gz: fc5eaa86aaaa89df100d197d2be6dc24e94c5ced57a35670ab70874de8b497a9642f612ef7ff2d67c47874f51984d45de73d0d504ac5aa1982fac659343cb26a
@@ -15,10 +15,12 @@ module Multiwoven
15
15
  end
16
16
 
17
17
  def meta_data
18
- client_meta_data = read_json(META_DATA_PATH).to_h
19
- icon_name = client_meta_data.with_indifferent_access["data"]["icon"]
18
+ client_meta_data = read_json(META_DATA_PATH).deep_symbolize_keys
19
+ icon_name = client_meta_data[:data][:icon]
20
20
  icon_url = "https://raw.githubusercontent.com/Multiwoven/multiwoven-integrations/#{MAIN_BRANCH_SHA}/assets/images/connectors/#{icon_name}"
21
- @meta_data ||= client_meta_data.merge!({ "icon": icon_url })
21
+ client_meta_data[:data][:icon] = icon_url
22
+
23
+ @meta_data ||= client_meta_data
22
24
  end
23
25
 
24
26
  def check_connection(_connection_config)
@@ -5,11 +5,18 @@ module Multiwoven
5
5
  class SourceConnector < BaseConnector
6
6
  def read(_sync_config)
7
7
  raise "Not implemented"
8
- # return list of RecordMessage
8
+ # setup sync configs
9
+ # call query(connection, query)
9
10
  end
10
11
 
11
12
  private
12
13
 
14
+ # This needs to be implemented as private method
15
+ # In every source connector. This will be used for model preview
16
+ def query(connection, query)
17
+ # return list of RecordMessage
18
+ end
19
+
13
20
  def batched_query(sql_query, limit, offset)
14
21
  offset = offset.to_i
15
22
  limit = limit.to_i
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.1.13"
5
+ VERSION = "0.1.14"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
@@ -51,13 +51,8 @@ module Multiwoven::Integrations::Source
51
51
  query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?
52
52
 
53
53
  bigquery = create_connection(connection_config)
54
- records = []
55
- results = bigquery.query(query) || []
56
- results.each do |row|
57
- records << RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
58
- end
59
54
 
60
- records
55
+ query(bigquery, query)
61
56
  rescue StandardError => e
62
57
  handle_exception(
63
58
  "BIGQUERY:READ:EXCEPTION",
@@ -66,6 +61,17 @@ module Multiwoven::Integrations::Source
66
61
  )
67
62
  end
68
63
 
64
+ private
65
+
66
+ def query(connection, query)
67
+ records = []
68
+ results = connection.query(query) || []
69
+ results.each do |row|
70
+ records << RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
71
+ end
72
+ records
73
+ end
74
+
69
75
  def create_connection(connection_config)
70
76
  Google::Cloud::Bigquery.new(
71
77
  project: connection_config["project_id"],
@@ -50,12 +50,8 @@ module Multiwoven::Integrations::Source
50
50
  query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?
51
51
 
52
52
  db = create_connection(connection_config)
53
- records = db.exec(query) do |result|
54
- result.map do |row|
55
- RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
56
- end
57
- end
58
- records
53
+
54
+ query(db, query)
59
55
  rescue StandardError => e
60
56
  handle_exception(
61
57
  "REDSHIFT:READ:EXCEPTION",
@@ -68,6 +64,14 @@ module Multiwoven::Integrations::Source
68
64
 
69
65
  private
70
66
 
67
+ def query(connection, query)
68
+ connection.exec(query) do |result|
69
+ result.map do |row|
70
+ RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
71
+ end
72
+ end
73
+ end
74
+
71
75
  def create_connection(connection_config)
72
76
  raise "Unsupported Auth type" unless connection_config[:credentials][:auth_type] == "username/password"
73
77
 
@@ -43,12 +43,7 @@ module Multiwoven::Integrations::Source
43
43
 
44
44
  db = create_connection(connection_config)
45
45
 
46
- records = []
47
- db.fetch(query) do |row|
48
- records << RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
49
- end
50
-
51
- records
46
+ query(db, query)
52
47
  rescue StandardError => e
53
48
  handle_exception(
54
49
  "SNOWFLAKE:READ:EXCEPTION",
@@ -59,6 +54,14 @@ module Multiwoven::Integrations::Source
59
54
 
60
55
  private
61
56
 
57
+ def query(connection, query)
58
+ records = []
59
+ connection.fetch(query) do |row|
60
+ records << RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
61
+ end
62
+ records
63
+ end
64
+
62
65
  def create_connection(connection_config)
63
66
  raise "Unsupported Auth type" if connection_config[:credentials][:auth_type] != "username/password"
64
67
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiwoven-integrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subin T P