multiwoven-integrations 0.1.75 → 0.2.0

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: ae5784806bc5de9222274f6a03be3883720e308f1e0922a76a588f5e582112fb
4
- data.tar.gz: 065a346c9beebf746e1e8d6d4a7b49d76c01185005269df442e58719933ca9f4
3
+ metadata.gz: 91cf72711d231942521cb83dd735b0a4b9067bd30d2aaeecf2be27d69d163da2
4
+ data.tar.gz: 5f2cc42a72e86cb0d8d1ed590c6fc337aa4539892305fc4f0502c74c7bb5dfa7
5
5
  SHA512:
6
- metadata.gz: 00fa3449d0395073e4b5277d105b5331c19e4290e9a8972baa80bc80aeee6ef63effcf94bc0484ced2ea79bb33900467bd2a68ee85b8a8d2796af317a9ef9340
7
- data.tar.gz: 263e855471164f79df4acafb32116b752cd3945d2439fc29eea4540ee2c6360d80d472caf2996475a4b3398a68d0361d907e2f5a8844ca4f2cd123da02706155
6
+ metadata.gz: 392ac958aeb012d4e1bf48daadbe168cf8e0cabd095fd79d155ed8fa4cc14cd8967974d9ee0085e4cf36ac9b78111d09da6e631fe21f97fd5be2136200fd56af
7
+ data.tar.gz: e3e76a87549ad98f9bed153746035fc1c6672ec30754eb1943a54d43cf2dbe253cbc3bb4235c4b11c9b98544856ff432cbd067af36bada6a12422d835426acca
@@ -13,6 +13,12 @@ module Multiwoven
13
13
 
14
14
  private
15
15
 
16
+ # This needs to be implemented as private method
17
+ # In every source connector. This will be used for model preview
18
+ def create_connection(connector_config)
19
+ # return a connection to the client's source
20
+ end
21
+
16
22
  # This needs to be implemented as private method
17
23
  # In every source connector. This will be used for model preview
18
24
  def query(connection, query)
@@ -0,0 +1,113 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven
4
+ module Integrations
5
+ module Destination
6
+ module Iterable
7
+ include Multiwoven::Integrations::Core
8
+ class Client < DestinationConnector
9
+ MAX_CHUNK_SIZE = 10
10
+ def check_connection(connection_config)
11
+ connection_config = connection_config.with_indifferent_access
12
+ initialize_client(connection_config)
13
+ channels = ::Iterable::Channels.new
14
+ response = channels.all
15
+ if response.success?
16
+ success_status
17
+ else
18
+ failure_status(nil)
19
+ end
20
+ rescue StandardError => e
21
+ handle_exception(e, {
22
+ context: "ITERABLE:CHECK_CONNECTION:EXCEPTION",
23
+ type: "error"
24
+ })
25
+ failure_status(e)
26
+ end
27
+
28
+ def discover(_connection_config = nil)
29
+ catalog = build_catalog(load_catalog)
30
+ catalog.to_multiwoven_message
31
+ rescue StandardError => e
32
+ handle_exception(
33
+ "ITERABLE:DISCOVER:EXCEPTION",
34
+ "error",
35
+ e
36
+ )
37
+ end
38
+
39
+ def write(sync_config, records, action = "create")
40
+ @action = sync_config.stream.action || action
41
+ connection_config = sync_config.destination.connection_specification.with_indifferent_access
42
+ initialize_client(connection_config)
43
+ process_records(records, sync_config.stream)
44
+ rescue StandardError => e
45
+ handle_exception("ITERABLE:WRITE:EXCEPTION", "error", e)
46
+ end
47
+
48
+ private
49
+
50
+ def initialize_client(connection_config)
51
+ ::Iterable.configure do |config|
52
+ config.token = connection_config[:api_key]
53
+ end
54
+ end
55
+
56
+ def process_records(records, stream)
57
+ write_success = 0
58
+ write_failure = 0
59
+ records.each do |record_object|
60
+ record = extract_data(record_object, stream.json_schema[:properties])
61
+ response = process_stream(record, stream)
62
+ if response.success?
63
+ write_success += 1
64
+ else
65
+ write_failure += 1
66
+ end
67
+ rescue StandardError => e
68
+ handle_exception("ITERABLE:WRITE:EXCEPTION", "error", e)
69
+ write_failure += 1
70
+ end
71
+ tracking_message(write_success, write_failure)
72
+ end
73
+
74
+ def process_stream(record, stream)
75
+ klass = ::Iterable.const_get(stream.name).new(*initialize_params(stream, record))
76
+ item_attrs = initialize_attribute(stream, record)
77
+ if stream.name == "CatalogItems"
78
+ klass.send(@action, item_attrs)
79
+ else
80
+ klass.send(@action)
81
+ end
82
+ end
83
+
84
+ def initialize_params(stream, record)
85
+ if stream.name == "CatalogItems"
86
+ [record[:catalog_name], record[:item_id]]
87
+ else
88
+ [record[:catalog]]
89
+ end
90
+ end
91
+
92
+ def initialize_attribute(stream, record)
93
+ if stream.name == "CatalogItems"
94
+ JSON.parse(record[:item_attribute])
95
+ else
96
+ {}
97
+ end
98
+ end
99
+
100
+ def tracking_message(success, failure)
101
+ Multiwoven::Integrations::Protocol::TrackingMessage.new(
102
+ success: success, failed: failure
103
+ ).to_multiwoven_message
104
+ end
105
+
106
+ def load_catalog
107
+ read_json(CATALOG_SPEC_PATH)
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,47 @@
1
+ {
2
+ "request_rate_limit": 6000,
3
+ "request_rate_limit_unit": "minute",
4
+ "request_rate_concurrency": 10,
5
+ "streams": [
6
+ {
7
+ "name": "Catalogs",
8
+ "action": "create",
9
+ "json_schema": {
10
+ "type": "object",
11
+ "properties": {
12
+ "catalog": {
13
+ "type": "string"
14
+ }
15
+ }
16
+ },
17
+ "response_type": "application/json",
18
+ "supported_sync_modes": ["incremental"],
19
+ "source_defined_cursor": true
20
+ },
21
+ {
22
+ "name": "CatalogItems",
23
+ "action": "create",
24
+ "json_schema": {
25
+ "type": "object",
26
+ "required": ["catalog_name", "item_id", "item_attribute"],
27
+ "properties": {
28
+ "catalog_name": {
29
+ "type": "string"
30
+ },
31
+ "item_id": {
32
+ "type": "string"
33
+ },
34
+ "item_attribute": {
35
+ "type": "string",
36
+ "description": "String must be in json format"
37
+ }
38
+ }
39
+ },
40
+ "response_type": "application/json",
41
+ "supported_sync_modes": ["incremental"],
42
+ "source_defined_cursor": true,
43
+ "default_cursor_field": ["updated"],
44
+ "source_defined_primary_key": [["catalog_name"]]
45
+ }
46
+ ]
47
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "data": {
3
+ "name": "Iterable",
4
+ "title": "Iterable",
5
+ "connector_type": "destination",
6
+ "category": "Marketing Automation",
7
+ "documentation_url": "https://docs.multiwoven.com/destinations/iterable",
8
+ "github_issue_label": "destination-iterable",
9
+ "icon": "icon.svg",
10
+ "license": "MIT",
11
+ "release_stage": "alpha",
12
+ "support_level": "community",
13
+ "tags": ["language:ruby", "multiwoven"]
14
+ }
15
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "documentation_url": "https://docs.multiwoven.com/integrations/destination/iterable",
3
+ "stream_type": "static",
4
+ "connection_specification": {
5
+ "$schema": "http://json-schema.org/draft-07/schema#",
6
+ "title": "Iterable",
7
+ "type": "object",
8
+ "required": ["api_key"],
9
+ "properties": {
10
+ "api_key": {
11
+ "description": "The Iterable API key.",
12
+ "type": "string",
13
+ "multiwoven_secret": true,
14
+ "title": "api_key",
15
+ "order": 0
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,71 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.4.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 292 193.6" style="enable-background:new 0 0 292 193.6;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{opacity:0.25;fill:#59C1A7;enable-background:new ;}
7
+ .st1{opacity:0.25;fill:#36C3F2;enable-background:new ;}
8
+ .st2{opacity:0.15;fill:#EF3D55;enable-background:new ;}
9
+ .st3{opacity:0.15;fill:#6A266D;enable-background:new ;}
10
+ .st4{fill:#6A266D;}
11
+ .st5{fill:#36C3F2;}
12
+ .st6{fill:#59C1A7;}
13
+ .st7{fill:#EF3D55;}
14
+ .st8{fill:#333332;}
15
+ .st9{fill:none;}
16
+ </style>
17
+ <g id="Lines">
18
+
19
+ <rect x="140.4" y="74.4" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -12.7722 138.3672)" class="st0" width="40.4" height="20.3"/>
20
+
21
+ <rect x="150.3" y="35.6" transform="matrix(0.7071 -0.7071 0.7071 0.7071 7.5244 129.821)" class="st1" width="20.3" height="40.4"/>
22
+
23
+ <rect x="121.3" y="64.4" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -21.341 117.7495)" class="st2" width="20.3" height="40.4"/>
24
+
25
+ <rect x="111.9" y="45" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -0.2944 109.5877)" class="st3" width="40.4" height="20.4"/>
26
+ </g>
27
+ <g id="Nodes">
28
+ <circle class="st4" cx="146" cy="41.3" r="10.2"/>
29
+ <circle class="st5" cx="174.9" cy="70.4" r="10.2"/>
30
+ <circle class="st6" cx="146" cy="99.3" r="10.2"/>
31
+ <circle class="st7" cx="117.1" cy="70.3" r="10.2"/>
32
+ </g>
33
+ <g id="Iterable">
34
+ <path class="st8" d="M116.7,139.6h-12.5c-0.2,0-0.4,0.2-0.4,0.4v22c0,0.2,0.2,0.4,0.4,0.4h12.5c0.2,0,0.4-0.2,0.4-0.4v-3.5
35
+ c0-0.2-0.2-0.4-0.4-0.4h-7.6c-0.4,0-0.8-0.3-0.8-0.8c0,0,0,0,0,0v-3.6c0-0.4,0.3-0.8,0.8-0.8c0,0,0,0,0,0h7c0.2,0,0.4-0.2,0.4-0.4
36
+ v-3.1c0-0.2-0.2-0.4-0.4-0.4h-7c-0.4,0-0.8-0.3-0.8-0.8c0,0,0,0,0,0v-3.4c0-0.4,0.3-0.8,0.8-0.8c0,0,0,0,0,0h7.6
37
+ c0.2,0,0.4-0.2,0.4-0.4v-3.5C117.1,139.8,116.9,139.6,116.7,139.6C116.7,139.6,116.7,139.6,116.7,139.6z"/>
38
+ <path class="st8" d="M168.6,162.4c0.1,0,0.3-0.1,0.3-0.2c0.1-0.1,0.1-0.3,0-0.4l-8.8-22c-0.1-0.2-0.2-0.3-0.4-0.3h-2.2
39
+ c-0.2,0-0.3,0.1-0.4,0.3l-8.8,22c-0.1,0.1-0.1,0.3,0,0.4c0.1,0.1,0.2,0.2,0.3,0.2h4c0.2,0,0.3-0.1,0.4-0.3l1.1-3
40
+ c0.1-0.3,0.4-0.5,0.8-0.5h7.4c0.3,0,0.6,0.2,0.8,0.5l1.1,3c0.1,0.2,0.2,0.3,0.4,0.3H168.6z M161,154.3c-0.1,0.2-0.4,0.3-0.6,0.3
41
+ h-3.5c-0.3,0-0.5-0.1-0.6-0.3c-0.1-0.2-0.2-0.5-0.1-0.7l1.7-4.8c0.1-0.4,0.6-0.6,1-0.5c0.2,0.1,0.4,0.3,0.5,0.5l1.7,4.8
42
+ C161.2,153.9,161.1,154.1,161,154.3z"/>
43
+ <path class="st8" d="M212.1,162.4c0.2,0,0.4-0.2,0.4-0.4v-3.5c0-0.2-0.2-0.4-0.4-0.4h-6.5c-0.4,0-0.8-0.3-0.8-0.8c0,0,0,0,0,0V140
44
+ c0-0.2-0.2-0.4-0.4-0.4h-3.6c-0.2,0-0.4,0.2-0.4,0.4v22c0,0.2,0.2,0.4,0.4,0.4L212.1,162.4z"/>
45
+ <path class="st8" d="M176.7,162.4h8.6c1.3,0,2.7-0.3,3.8-0.9c2-1.1,3.3-3.2,3.3-5.6c0.1-2.4-1.3-4.6-3.4-5.6
46
+ c-0.1,0-0.1-0.1-0.1-0.2V150l0.1-0.1c1.3-1.1,2-2.7,2-4.3c0-1-0.3-2.1-0.8-3c-0.5-0.9-1.3-1.7-2.3-2.2c-1.2-0.6-2.5-0.9-3.8-0.8
47
+ h-7.3c-0.2,0-0.4,0.2-0.5,0.4c0,0,0,0,0,0V162C176.3,162.2,176.4,162.4,176.7,162.4C176.7,162.4,176.7,162.4,176.7,162.4z
48
+ M180.7,144.6c0-0.4,0.3-0.7,0.7-0.7c0,0,0,0,0,0h2c0.8,0,1.5,0.2,2.1,0.7c0.4,0.4,0.7,0.9,0.8,1.4c0.1,0.8-0.2,1.6-0.8,2.1
49
+ c-0.6,0.5-1.3,0.8-2.1,0.8h-2c-0.4,0-0.7-0.3-0.7-0.7c0,0,0,0,0,0L180.7,144.6z M180.7,153.4c0-0.4,0.3-0.7,0.7-0.7c0,0,0,0,0,0h3
50
+ c0.8,0,1.6,0.2,2.2,0.8c0.6,0.5,0.9,1.2,0.9,1.9c0,0.8-0.3,1.5-0.8,2c-0.6,0.6-1.4,0.8-2.2,0.8h-3c-0.4,0-0.7-0.3-0.7-0.7l0,0
51
+ L180.7,153.4z"/>
52
+ <path class="st8" d="M137.7,154.5c-0.2-0.4-0.1-0.9,0.3-1.1c0,0,0,0,0,0c1-0.6,1.8-1.4,2.4-2.4c0.7-1.2,1.1-2.6,1-4
53
+ c0-1.3-0.4-2.6-1-3.7c-0.6-1.1-1.6-2.1-2.7-2.8c-1.2-0.7-2.7-1.1-4.1-1.1h-7c-0.2,0-0.4,0.2-0.4,0.4v22c0,0.2,0.2,0.4,0.4,0.4h3.6
54
+ c0.2,0,0.4-0.2,0.4-0.4v-6.6c0-0.4,0.3-0.8,0.8-0.8c0,0,0,0,0,0h1.1c0.3,0,0.6,0.2,0.7,0.4l3.8,7.2c0.1,0.1,0.2,0.2,0.4,0.2h4.2
55
+ c0.2,0,0.4-0.2,0.4-0.4c0-0.1,0-0.1,0-0.2L137.7,154.5z M135.8,149.4c-0.7,0.6-1.6,0.9-2.5,0.9h-1.8c-0.4,0-0.8-0.3-0.8-0.8
56
+ c0,0,0,0,0,0v-4.7c0-0.4,0.3-0.8,0.8-0.8c0,0,0,0,0,0h1.8c0.9,0,1.8,0.3,2.5,0.9C137.1,146.1,137.1,148.1,135.8,149.4
57
+ C135.9,149.4,135.8,149.4,135.8,149.4L135.8,149.4z"/>
58
+ <path class="st8" d="M95.4,139.6H81c-0.2,0-0.4,0.2-0.4,0.4l0,0v3.5c0,0.2,0.2,0.4,0.4,0.4h4.2c0.4,0,0.8,0.3,0.8,0.8c0,0,0,0,0,0
59
+ l0,0v17.3c0,0.2,0.2,0.4,0.4,0.4h3.7c0.2,0,0.4-0.2,0.4-0.4l0,0v-17.4c0-0.4,0.3-0.8,0.8-0.8c0,0,0,0,0,0h4.1
60
+ c0.2,0,0.4-0.2,0.4-0.4V140C95.8,139.8,95.6,139.6,95.4,139.6L95.4,139.6z"/>
61
+ <path class="st8" d="M233.4,158.1h-7.6c-0.4,0-0.8-0.3-0.8-0.8c0,0,0,0,0,0v-3.6c0-0.4,0.3-0.8,0.8-0.8c0,0,0,0,0,0h7
62
+ c0.2,0,0.4-0.2,0.4-0.4v-3.1c0-0.2-0.2-0.4-0.4-0.4h-7c-0.4,0-0.8-0.3-0.8-0.7c0,0,0,0,0,0v-3.4c0-0.4,0.3-0.8,0.8-0.8c0,0,0,0,0,0
63
+ h7.6c0.2,0,0.4-0.2,0.4-0.4v-3.5c0-0.2-0.2-0.4-0.4-0.4h-12.5c-0.2,0-0.4,0.2-0.4,0.4v22c0,0.2,0.2,0.4,0.4,0.4h12.5
64
+ c0.2,0,0.4-0.2,0.4-0.4v-3.5C233.8,158.3,233.6,158.1,233.4,158.1z"/>
65
+ <path class="st8" d="M72.1,158.1h-3.6c-0.4,0-0.8-0.3-0.8-0.8c0,0,0,0,0,0l0,0v-12.6c0-0.4,0.3-0.8,0.8-0.8c0,0,0,0,0,0h3.6
66
+ c0.2,0,0.4-0.2,0.4-0.4l0,0V140c0-0.2-0.2-0.4-0.4-0.4H58.6c-0.2,0-0.4,0.2-0.4,0.4l0,0v3.5c0,0.2,0.2,0.4,0.4,0.4h3.8
67
+ c0.4,0,0.8,0.3,0.8,0.8c0,0,0,0,0,0v12.6c0,0.4-0.4,0.8-0.8,0.8h-3.8c-0.2,0-0.4,0.2-0.4,0.4l0,0v3.5c0,0.2,0.2,0.4,0.4,0.4h4.9
68
+ c0,0,0.1,0,0.1,0h3.7c0,0,0.1,0,0.1,0h4.8c0.2,0,0.4-0.2,0.4-0.4l0,0v-3.5C72.6,158.3,72.4,158.1,72.1,158.1L72.1,158.1z"/>
69
+ </g>
70
+ <rect x="50" y="25.3" class="st9" width="192" height="143"/>
71
+ </svg>
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Multiwoven
4
4
  module Integrations
5
- VERSION = "0.1.75"
5
+ VERSION = "0.2.0"
6
6
 
7
7
  ENABLED_SOURCES = %w[
8
8
  Snowflake
@@ -13,6 +13,7 @@ module Multiwoven
13
13
  SalesforceConsumerGoodsCloud
14
14
  AwsAthena
15
15
  Clickhouse
16
+ AmazonS3
16
17
  ].freeze
17
18
 
18
19
  ENABLED_DESTINATIONS = %w[
@@ -29,6 +30,7 @@ module Multiwoven
29
30
  Postgresql
30
31
  Http
31
32
  Zendesk
33
+ Iterable
32
34
  ].freeze
33
35
  end
34
36
  end
@@ -0,0 +1,151 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Multiwoven::Integrations::Source
4
+ module AmazonS3
5
+ include Multiwoven::Integrations::Core
6
+ class Client < SourceConnector
7
+ DISCOVER_QUERY = "SELECT * FROM S3Object LIMIT 1;"
8
+
9
+ def check_connection(connection_config)
10
+ connection_config = connection_config.with_indifferent_access
11
+ client = config_aws(connection_config)
12
+ client.get_bucket_policy_status({ bucket: connection_config[:bucket] })
13
+ ConnectionStatus.new(status: ConnectionStatusType["succeeded"]).to_multiwoven_message
14
+ rescue StandardError => e
15
+ ConnectionStatus.new(status: ConnectionStatusType["failed"], message: e.message).to_multiwoven_message
16
+ end
17
+
18
+ def discover(connection_config)
19
+ connection_config = connection_config.with_indifferent_access
20
+ conn = create_connection(connection_config)
21
+ # If pulling from multiple files, all files must have the same schema
22
+ path = build_path(connection_config[:path])
23
+ full_path = "s3://#{connection_config[:bucket]}/#{path}*.#{connection_config[:file_type]}"
24
+ records = get_results(conn, "DESCRIBE SELECT * FROM '#{full_path}';")
25
+ columns = build_discover_columns(records)
26
+ streams = [Multiwoven::Integrations::Protocol::Stream.new(name: full_path, action: StreamAction["fetch"], json_schema: convert_to_json_schema(columns))]
27
+ catalog = Catalog.new(streams: streams)
28
+ catalog.to_multiwoven_message
29
+ rescue StandardError => e
30
+ handle_exception(e, { context: "AMAZONS3:DISCOVER:EXCEPTION", type: "error" })
31
+ end
32
+
33
+ def read(sync_config)
34
+ connection_config = sync_config.source.connection_specification.with_indifferent_access
35
+ conn = create_connection(connection_config)
36
+ query = sync_config.model.query
37
+ query = batched_query(query, sync_config.limit, sync_config.offset) unless sync_config.limit.nil? && sync_config.offset.nil?
38
+ query(conn, query)
39
+ rescue StandardError => e
40
+ handle_exception(e, {
41
+ context: "AMAZONS3:READ:EXCEPTION",
42
+ type: "error",
43
+ sync_id: sync_config.sync_id,
44
+ sync_run_id: sync_config.sync_run_id
45
+ })
46
+ end
47
+
48
+ private
49
+
50
+ # DuckDB
51
+ def create_connection(connection_config)
52
+ conn = DuckDB::Database.open.connect
53
+ # Set up S3 configuration
54
+ secret_query = "
55
+ CREATE SECRET amazons3_source (
56
+ TYPE S3,
57
+ KEY_ID '#{connection_config[:access_id]}',
58
+ SECRET '#{connection_config[:secret_access]}',
59
+ REGION '#{connection_config[:region]}'
60
+ );
61
+ "
62
+ get_results(conn, secret_query)
63
+ conn
64
+ end
65
+
66
+ def build_path(path)
67
+ path = "#{path}/" if !path.to_s.strip.empty? && path[-1] != "/"
68
+ path
69
+ end
70
+
71
+ def get_results(conn, query)
72
+ results = conn.query(query)
73
+ hash_array_values(results)
74
+ end
75
+
76
+ def query(conn, query)
77
+ records = get_results(conn, query)
78
+ records.map do |row|
79
+ RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
80
+ end
81
+ end
82
+
83
+ def hash_array_values(describe)
84
+ keys = describe.columns.map(&:name)
85
+ describe.map do |row|
86
+ Hash[keys.zip(row)]
87
+ end
88
+ end
89
+
90
+ def build_discover_columns(describe_results)
91
+ describe_results.map do |row|
92
+ type = column_schema_helper(row["column_type"])
93
+ {
94
+ column_name: row["column_name"],
95
+ type: type
96
+ }
97
+ end
98
+ end
99
+
100
+ def column_schema_helper(column_type)
101
+ case column_type
102
+ when "VARCHAR", "BIT", "DATE", "TIME", "TIMESTAMP", "UUID"
103
+ "string"
104
+ when "DOUBLE"
105
+ "number"
106
+ when "BIGINT", "HUGEINT", "INTEGER", "SMALLINT"
107
+ "integer"
108
+ when "BOOLEAN"
109
+ "boolean"
110
+ end
111
+ end
112
+
113
+ # AWS SDK
114
+ def config_aws(config)
115
+ config = config.with_indifferent_access
116
+ Aws.config.update({
117
+ region: config[:region],
118
+ credentials: Aws::Credentials.new(config[:access_id], config[:secret_access])
119
+ })
120
+ config.with_indifferent_access
121
+ Aws::S3::Client.new
122
+ end
123
+
124
+ def build_select_content_options(config, query)
125
+ config = config.with_indifferent_access
126
+ bucket_name = config[:bucket]
127
+ file_key = config[:file_key]
128
+ file_type = config[:file_type]
129
+ options = {
130
+ bucket: bucket_name,
131
+ key: file_key,
132
+ expression_type: "SQL",
133
+ expression: query,
134
+ output_serialization: {
135
+ json: {}
136
+ }
137
+ }
138
+ if file_type == "parquet"
139
+ options[:input_serialization] = {
140
+ parquet: {}
141
+ }
142
+ elsif file_type == "csv"
143
+ options[:input_serialization] = {
144
+ csv: { file_header_info: "USE" }
145
+ }
146
+ end
147
+ options
148
+ end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,15 @@
1
+ {
2
+ "data": {
3
+ "name": "AmazonS3",
4
+ "title": "Amazon S3",
5
+ "connector_type": "source",
6
+ "category": "Data Lake",
7
+ "documentation_url": "https://docs.mutliwoven.com",
8
+ "github_issue_label": "source-amazons3",
9
+ "icon": "icon.svg",
10
+ "license": "MIT",
11
+ "release_stage": "alpha",
12
+ "support_level": "community",
13
+ "tags": ["language:ruby", "multiwoven"]
14
+ }
15
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "documentation_url": "https://docs.multiwoven.com/integrations/sources/amazons3",
3
+ "stream_type": "dynamic",
4
+ "connector_query_type": "raw_sql",
5
+ "connection_specification": {
6
+ "$schema": "http://json-schema.org/draft-07/schema#",
7
+ "title": "AmazonS3",
8
+ "type": "object",
9
+ "required": ["region", "bucket", "access_id", "secret_access", "file_type"],
10
+ "properties": {
11
+ "region": {
12
+ "description": "AWS region",
13
+ "examples": ["us-east-2"],
14
+ "type": "string",
15
+ "title": "Region",
16
+ "order": 1
17
+ },
18
+ "access_id": {
19
+ "type": "string",
20
+ "title": "Access Id",
21
+ "order": 2
22
+ },
23
+ "secret_access": {
24
+ "type": "string",
25
+ "title": "Secret Access",
26
+ "multiwoven_secret": true,
27
+ "order": 3
28
+ },
29
+ "bucket": {
30
+ "description": "Bucket Name",
31
+ "type": "string",
32
+ "title": "Bucket",
33
+ "order": 4
34
+ },
35
+ "path": {
36
+ "description": "Path to csv or parquet files",
37
+ "examples": ["/path/to/files"],
38
+ "type": "string",
39
+ "title": "Path",
40
+ "order": 5
41
+ },
42
+ "file_type": {
43
+ "description": "The type of file to read",
44
+ "type": "string",
45
+ "title": "File Type",
46
+ "enum": ["csv", "parquet"],
47
+ "order": 6
48
+ }
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,34 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="428" height="512" viewBox="0 0 428 512">
2
+ <defs>
3
+ <style>
4
+ .cls-1 {
5
+ fill: #e25444;
6
+ }
7
+
8
+ .cls-1, .cls-2, .cls-3 {
9
+ fill-rule: evenodd;
10
+ }
11
+
12
+ .cls-2 {
13
+ fill: #7b1d13;
14
+ }
15
+
16
+ .cls-3 {
17
+ fill: #58150d;
18
+ }
19
+ </style>
20
+ </defs>
21
+ <path class="cls-1" d="M378,99L295,257l83,158,34-19V118Z"/>
22
+ <path class="cls-2" d="M378,99L212,118,127.5,257,212,396l166,19V99Z"/>
23
+ <path class="cls-3" d="M43,99L16,111V403l27,12L212,257Z"/>
24
+ <path class="cls-1" d="M42.637,98.667l169.587,47.111V372.444L42.637,415.111V98.667Z"/>
25
+ <path class="cls-3" d="M212.313,170.667l-72.008-11.556,72.008-81.778,71.83,81.778Z"/>
26
+ <path class="cls-3" d="M284.143,159.111l-71.919,11.733-71.919-11.733V77.333"/>
27
+ <path class="cls-3" d="M212.313,342.222l-72.008,13.334,72.008,70.222,71.83-70.222Z"/>
28
+ <path class="cls-2" d="M212,16L140,54V159l72.224-20.333Z"/>
29
+ <path class="cls-2" d="M212.224,196.444l-71.919,7.823V309.105l71.919,8.228V196.444Z"/>
30
+ <path class="cls-2" d="M212.224,373.333L140.305,355.3V458.363L212.224,496V373.333Z"/>
31
+ <path class="cls-1" d="M284.143,355.3l-71.919,18.038V496l71.919-37.637V355.3Z"/>
32
+ <path class="cls-1" d="M212.224,196.444l71.919,7.823V309.105l-71.919,8.228V196.444Z"/>
33
+ <path class="cls-1" d="M212,16l72,38V159l-72-20V16Z"/>
34
+ </svg>
@@ -27,6 +27,9 @@ require "zip"
27
27
  require "zendesk_api"
28
28
  require "faraday"
29
29
  require "base64"
30
+ require "aws-sdk-s3"
31
+ require "duckdb"
32
+ require "iterable-api-client"
30
33
 
31
34
  # Service
32
35
  require_relative "integrations/config"
@@ -54,6 +57,7 @@ require_relative "integrations/source/databricks/client"
54
57
  require_relative "integrations/source/salesforce_consumer_goods_cloud/client"
55
58
  require_relative "integrations/source/aws_athena/client"
56
59
  require_relative "integrations/source/clickhouse/client"
60
+ require_relative "integrations/source/amazon_s3/client"
57
61
 
58
62
  # Destination
59
63
  require_relative "integrations/destination/klaviyo/client"
@@ -69,6 +73,7 @@ require_relative "integrations/destination/sftp/client"
69
73
  require_relative "integrations/destination/postgresql/client"
70
74
  require_relative "integrations/destination/http/client"
71
75
  require_relative "integrations/destination/zendesk/client"
76
+ require_relative "integrations/destination/iterable/client"
72
77
 
73
78
  module Multiwoven
74
79
  module Integrations
@@ -36,14 +36,17 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency "activesupport"
37
37
  spec.add_runtime_dependency "async-websocket"
38
38
  spec.add_runtime_dependency "aws-sdk-athena"
39
+ spec.add_runtime_dependency "aws-sdk-s3"
39
40
  spec.add_runtime_dependency "csv"
40
41
  spec.add_runtime_dependency "dry-schema"
41
42
  spec.add_runtime_dependency "dry-struct"
42
43
  spec.add_runtime_dependency "dry-types"
44
+ spec.add_runtime_dependency "duckdb"
43
45
  spec.add_runtime_dependency "git"
44
46
  spec.add_runtime_dependency "google-apis-sheets_v4"
45
47
  spec.add_runtime_dependency "google-cloud-bigquery"
46
48
  spec.add_runtime_dependency "hubspot-api-client"
49
+ spec.add_runtime_dependency "iterable-api-client"
47
50
  spec.add_runtime_dependency "net-sftp"
48
51
  spec.add_runtime_dependency "pg"
49
52
  spec.add_runtime_dependency "rake"
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.1.75
4
+ version: 0.2.0
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: 2024-06-06 00:00:00.000000000 Z
11
+ date: 2024-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: aws-sdk-s3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: csv
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,20 @@ dependencies:
108
122
  - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: duckdb
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: git
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +192,20 @@ dependencies:
164
192
  - - ">="
165
193
  - !ruby/object:Gem::Version
166
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: iterable-api-client
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
167
209
  - !ruby/object:Gem::Dependency
168
210
  name: net-sftp
169
211
  requirement: !ruby/object:Gem::Requirement
@@ -456,6 +498,11 @@ files:
456
498
  - lib/multiwoven/integrations/destination/hubspot/config/meta.json
457
499
  - lib/multiwoven/integrations/destination/hubspot/config/spec.json
458
500
  - lib/multiwoven/integrations/destination/hubspot/icon.svg
501
+ - lib/multiwoven/integrations/destination/iterable/client.rb
502
+ - lib/multiwoven/integrations/destination/iterable/config/catalog.json
503
+ - lib/multiwoven/integrations/destination/iterable/config/meta.json
504
+ - lib/multiwoven/integrations/destination/iterable/config/spec.json
505
+ - lib/multiwoven/integrations/destination/iterable/icon.svg
459
506
  - lib/multiwoven/integrations/destination/klaviyo/client.rb
460
507
  - lib/multiwoven/integrations/destination/klaviyo/config/catalog.json
461
508
  - lib/multiwoven/integrations/destination/klaviyo/config/meta.json
@@ -500,6 +547,10 @@ files:
500
547
  - lib/multiwoven/integrations/protocol/protocol.rb
501
548
  - lib/multiwoven/integrations/rollout.rb
502
549
  - lib/multiwoven/integrations/service.rb
550
+ - lib/multiwoven/integrations/source/amazon_s3/client.rb
551
+ - lib/multiwoven/integrations/source/amazon_s3/config/meta.json
552
+ - lib/multiwoven/integrations/source/amazon_s3/config/spec.json
553
+ - lib/multiwoven/integrations/source/amazon_s3/icon.svg
503
554
  - lib/multiwoven/integrations/source/aws_athena/client.rb
504
555
  - lib/multiwoven/integrations/source/aws_athena/config/meta.json
505
556
  - lib/multiwoven/integrations/source/aws_athena/config/spec.json