multiwoven-integrations 0.1.13 → 0.1.15
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 +4 -4
- data/lib/multiwoven/integrations/core/base_connector.rb +5 -3
- data/lib/multiwoven/integrations/core/source_connector.rb +8 -1
- data/lib/multiwoven/integrations/destination/facebook_custom_audience/config/meta.json +1 -1
- data/lib/multiwoven/integrations/destination/salesforce_crm/config/meta.json +1 -1
- data/lib/multiwoven/integrations/rollout.rb +1 -1
- data/lib/multiwoven/integrations/service.rb +2 -2
- data/lib/multiwoven/integrations/source/bigquery/client.rb +12 -6
- data/lib/multiwoven/integrations/source/bigquery/config/meta.json +1 -1
- data/lib/multiwoven/integrations/source/redshift/client.rb +10 -6
- data/lib/multiwoven/integrations/source/snowflake/client.rb +9 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ecb2cd75c255a0eafd6eb964568ea33eb9b7256402b2f9644857b76646dce01
|
4
|
+
data.tar.gz: 59489ab31180446d458cb09246319479e637b171b13f82f4deebb4089e28f4cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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).
|
19
|
-
icon_name = client_meta_data
|
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
|
-
|
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
|
-
#
|
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
|
@@ -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 =
|
42
|
-
client.meta_data
|
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
|
-
|
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
|
-
|
54
|
-
|
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
|
-
|
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
|
|