multiwoven-integrations 0.1.13 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 823511ceb667f340a6a98cf55c054e7926060f259ae02ac9bd64e2667ce24dbf
4
- data.tar.gz: a6f2e9a533ab1f2ffecc8c40b7078a182296dad452d30968c6d6bc8de10304bc
3
+ metadata.gz: 6ecb2cd75c255a0eafd6eb964568ea33eb9b7256402b2f9644857b76646dce01
4
+ data.tar.gz: 59489ab31180446d458cb09246319479e637b171b13f82f4deebb4089e28f4cf
5
5
  SHA512:
6
- metadata.gz: 9feabb2d1de4402f301a6d2fa1d021973d17bf3d7b262dddd7a18e8a2136de5bba9aeb48247647a5ba698bfc4784ad1b01351042168900ea0b28b76f0696578e
7
- data.tar.gz: c114097c52b34c42307c7f1590b23321d21fbc0c9bbb429ee06b17b25dbf31649d522b2753e61c04ce82d81d2b79ea06428058e1dc144c91babad8007c7b560e
6
+ metadata.gz: 98c07060a572704b189ffdb99cf31c70b39eb6b5c12c07daa50a2a572bff73b7d9a4b7ac9e8e18b4182602f18c24eb6106b97609116557a6460b85712166e6c5
7
+ data.tar.gz: '09c2a44105dfd1437315f079c15df0b8d38466c48c3230ac7ec7ff44da43db14362ecdfe57f5c644217c61b5ee1beaf03e46f24859e088b3d0f91da1cfafcbbf'
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "data": {
3
- "name": "Facebook",
3
+ "name": "FacebookCustomAudience",
4
4
  "connector_type": "destination",
5
5
  "category": "Adtech",
6
6
  "documentation_url": "https://docs.mutliwoven.com",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "data": {
3
- "name": "Salesforce CRM",
3
+ "name": "SalesforceCrm",
4
4
  "connector_type": "destination",
5
5
  "category": "CRM",
6
6
  "documentation_url": "https://docs.mutliwoven.com",
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.1.13"
5
+ VERSION = "0.1.15"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
@@ -38,8 +38,8 @@ module Multiwoven
38
38
  def build_connectors(enabled_connectors, type)
39
39
  enabled_connectors.map do |connector|
40
40
  client = connector_class(type, connector).new
41
- connector_spec = { connector_spec: client.connector_spec.to_h }
42
- client.meta_data["data"].to_h.merge!(connector_spec)
41
+ client.meta_data[:data][:connector_spec] = client.connector_spec.to_h
42
+ client.meta_data
43
43
  end
44
44
  end
45
45
 
@@ -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"],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "data": {
3
- "name": "BigQuery",
3
+ "name": "Bigquery",
4
4
  "connector_type": "source",
5
5
  "category": "Data Warehouse",
6
6
  "documentation_url": "https://docs.mutliwoven.com",
@@ -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.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subin T P