etl-integrations 0.1.82 → 0.1.86
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -9
- data/LICENSE.txt +1 -1
- data/README.md +13 -13
- data/etl-integrations-0.1.79.gem +0 -0
- data/etl-integrations-0.1.85.gem +0 -0
- data/lib/{multiwoven → etl}/integrations/config.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/core/base_connector.rb +2 -2
- data/lib/{multiwoven → etl}/integrations/core/constants.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/core/destination_connector.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/core/fullrefresher.rb +2 -2
- data/lib/{multiwoven → etl}/integrations/core/http_client.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/core/query_builder.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/core/rate_limiter.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/core/source_connector.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/core/utils.rb +3 -3
- data/lib/{multiwoven → etl}/integrations/destination/airtable/client.rb +8 -8
- data/lib/{multiwoven → etl}/integrations/destination/airtable/schema_helper.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/destination/facebook_custom_audience/client.rb +6 -6
- data/lib/{multiwoven → etl}/integrations/destination/google_sheets/client.rb +5 -5
- data/lib/{multiwoven → etl}/integrations/destination/hubspot/client.rb +5 -5
- data/lib/{multiwoven → etl}/integrations/destination/klaviyo/client.rb +6 -6
- data/lib/{multiwoven → etl}/integrations/destination/postgresql/client.rb +5 -5
- data/lib/{multiwoven → etl}/integrations/destination/salesforce_consumer_goods_cloud/client.rb +5 -5
- data/lib/{multiwoven → etl}/integrations/destination/salesforce_consumer_goods_cloud/schema_helper.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/destination/salesforce_crm/client.rb +5 -5
- data/lib/{multiwoven → etl}/integrations/destination/sftp/client.rb +5 -5
- data/lib/{multiwoven → etl}/integrations/destination/slack/client.rb +4 -4
- data/lib/{multiwoven → etl}/integrations/destination/stripe/client.rb +5 -5
- data/lib/etl/integrations/destination/tally/client.rb +236 -0
- data/lib/{multiwoven → etl}/integrations/destination/tally/config/catalog.json +4 -1
- data/lib/{multiwoven → etl}/integrations/protocol/protocol.json +2 -2
- data/lib/{multiwoven → etl}/integrations/protocol/protocol.rb +2 -2
- data/lib/{multiwoven → etl}/integrations/rollout.rb +2 -2
- data/lib/{multiwoven → etl}/integrations/service.rb +3 -3
- data/lib/{multiwoven → etl}/integrations/source/bigquery/client.rb +3 -3
- data/lib/{multiwoven → etl}/integrations/source/databricks/client.rb +3 -3
- data/lib/{multiwoven → etl}/integrations/source/postgresql/client.rb +3 -3
- data/lib/{multiwoven → etl}/integrations/source/redshift/client.rb +3 -3
- data/lib/{multiwoven → etl}/integrations/source/salesforce_consumer_goods_cloud/client.rb +5 -5
- data/lib/{multiwoven → etl}/integrations/source/salesforce_consumer_goods_cloud/schema_helper.rb +1 -1
- data/lib/{multiwoven → etl}/integrations/source/snowflake/client.rb +3 -3
- data/lib/{multiwoven → etl}/integrations/source/zoho_books/client.rb +5 -5
- data/lib/{multiwoven → etl}/integrations.rb +1 -1
- data/sig/{multiwoven → etl}/integrations.rbs +1 -1
- metadata +117 -116
- data/lib/multiwoven/integrations/destination/tally/client.rb +0 -151
- data/multiwoven-integrations.gemspec +0 -65
- /data/{multiwoven-integrations-0.1.68.gem → etl-integrations-0.1.68.gem} +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/airtable/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/airtable/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/airtable/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/airtable/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/facebook_custom_audience/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/facebook_custom_audience/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/facebook_custom_audience/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/facebook_custom_audience/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/google_sheets/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/google_sheets/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/google_sheets/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/google_sheets/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/hubspot/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/hubspot/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/hubspot/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/hubspot/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/klaviyo/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/klaviyo/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/klaviyo/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/klaviyo/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/postgresql/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/postgresql/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/postgresql/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/salesforce_consumer_goods_cloud/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/salesforce_consumer_goods_cloud/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/salesforce_consumer_goods_cloud/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/salesforce_consumer_goods_cloud/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/salesforce_crm/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/salesforce_crm/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/salesforce_crm/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/salesforce_crm/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/sftp/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/sftp/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/sftp/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/sftp/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/slack/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/slack/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/slack/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/slack/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/stripe/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/stripe/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/stripe/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/stripe/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/tally/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/tally/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/destination/tally/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/bigquery/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/bigquery/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/bigquery/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/databricks/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/databricks/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/databricks/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/postgresql/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/postgresql/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/postgresql/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/redshift/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/redshift/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/redshift/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/salesforce_consumer_goods_cloud/config/catalog.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/salesforce_consumer_goods_cloud/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/salesforce_consumer_goods_cloud/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/salesforce_consumer_goods_cloud/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/snowflake/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/snowflake/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/snowflake/icon.svg +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/zoho_books/config/meta.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/zoho_books/config/spec.json +0 -0
- /data/lib/{multiwoven → etl}/integrations/source/zoho_books/icon.svg +0 -0
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module Etl
|
4
4
|
module Integrations
|
5
5
|
module Destination
|
6
6
|
module Slack
|
7
|
-
include
|
7
|
+
include Etl::Integrations::Core
|
8
8
|
|
9
9
|
class Client < DestinationConnector
|
10
|
-
prepend
|
10
|
+
prepend Etl::Integrations::Core::RateLimiter
|
11
11
|
attr_accessor :channel_id
|
12
12
|
|
13
13
|
def check_connection(connection_config)
|
@@ -103,7 +103,7 @@ module Multiwoven
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def tracking_message(success, failure)
|
106
|
-
|
106
|
+
Etl::Integrations::Protocol::TrackingMessage.new(
|
107
107
|
success: success, failed: failure
|
108
108
|
).to_multiwoven_message
|
109
109
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module Etl
|
4
4
|
module Integrations
|
5
5
|
module Destination
|
6
6
|
module Stripe
|
7
|
-
include
|
7
|
+
include Etl::Integrations::Core
|
8
8
|
|
9
9
|
API_VERSION = "59.0"
|
10
10
|
|
11
11
|
class Client < DestinationConnector
|
12
|
-
prepend
|
12
|
+
prepend Etl::Integrations::Core::RateLimiter
|
13
13
|
def check_connection(connection_config)
|
14
14
|
connection_config = connection_config.with_indifferent_access
|
15
15
|
initialize_client(connection_config)
|
@@ -67,13 +67,13 @@ module Multiwoven
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def tracking_message(success, failure)
|
70
|
-
|
70
|
+
Etl::Integrations::Protocol::TrackingMessage.new(
|
71
71
|
success: success, failed: failure
|
72
72
|
).to_multiwoven_message
|
73
73
|
end
|
74
74
|
|
75
75
|
def log_debug(message)
|
76
|
-
|
76
|
+
Etl::Integrations::Service.logger.debug(message)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -0,0 +1,236 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "stringio"
|
4
|
+
require "net/http"
|
5
|
+
require "uri"
|
6
|
+
require "json"
|
7
|
+
require 'builder' # Add builder gem for XML generation
|
8
|
+
|
9
|
+
module Etl
|
10
|
+
module Integrations
|
11
|
+
module Destination
|
12
|
+
module Tally
|
13
|
+
include Etl::Integrations::Core
|
14
|
+
include Etl::Integrations::Core::Utils
|
15
|
+
|
16
|
+
API_VERSION = "1.0"
|
17
|
+
|
18
|
+
class Client < DestinationConnector
|
19
|
+
prepend Etl::Integrations::Core::RateLimiter
|
20
|
+
|
21
|
+
def check_connection(connection_config)
|
22
|
+
connection_config = connection_config.with_indifferent_access
|
23
|
+
initialize_client(connection_config)
|
24
|
+
authenticate_client
|
25
|
+
success_status
|
26
|
+
rescue StandardError => e
|
27
|
+
failure_status(e)
|
28
|
+
end
|
29
|
+
|
30
|
+
def discover(_connection_config = nil)
|
31
|
+
catalog = build_catalog(load_catalog)
|
32
|
+
catalog.to_multiwoven_message
|
33
|
+
rescue StandardError => e
|
34
|
+
handle_exception("TALLY:DISCOVER:EXCEPTION", "error", e)
|
35
|
+
end
|
36
|
+
|
37
|
+
def write(sync_config, records, action = "create")
|
38
|
+
@action = sync_config.stream.action || action
|
39
|
+
initialize_client(sync_config.destination.connection_specification)
|
40
|
+
process_records(records, sync_config.stream)
|
41
|
+
rescue StandardError => e
|
42
|
+
handle_exception("TALLY:WRITE:EXCEPTION", "error", e)
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def initialize_client(config)
|
48
|
+
config = config.with_indifferent_access
|
49
|
+
@tally_url = config[:tally_url]
|
50
|
+
@company_name = config[:company_name]
|
51
|
+
|
52
|
+
check_tally_status(@tally_url)
|
53
|
+
end
|
54
|
+
|
55
|
+
def check_tally_status(tally_url)
|
56
|
+
uri = URI.parse(tally_url)
|
57
|
+
response = Net::HTTP.get_response(uri)
|
58
|
+
|
59
|
+
if response.is_a?(Net::HTTPSuccess)
|
60
|
+
puts "Tally is running at #{tally_url}"
|
61
|
+
else
|
62
|
+
raise "Tally is not running or not reachable at #{tally_url}"
|
63
|
+
end
|
64
|
+
rescue StandardError => e
|
65
|
+
raise "Error connecting to Tally: #{e.message}"
|
66
|
+
end
|
67
|
+
|
68
|
+
def process_records(records, stream)
|
69
|
+
write_success = 0
|
70
|
+
write_failure = 0
|
71
|
+
properties = stream.json_schema[:properties]
|
72
|
+
records.each do |record_object|
|
73
|
+
record = extract_data(record_object, properties)
|
74
|
+
xml_payload = convert_to_xml(record) # Convert record to XML
|
75
|
+
process_record(xml_payload)
|
76
|
+
write_success += 1
|
77
|
+
rescue StandardError => e
|
78
|
+
handle_exception("TALLY:WRITE:EXCEPTION", "error", e)
|
79
|
+
write_failure += 1
|
80
|
+
end
|
81
|
+
tracking_message(write_success, write_failure)
|
82
|
+
end
|
83
|
+
|
84
|
+
def process_record(xml_payload)
|
85
|
+
send_data_to_tally(xml_payload)
|
86
|
+
end
|
87
|
+
|
88
|
+
def send_data_to_tally(xml_payload = {})
|
89
|
+
uri = URI.parse("#{@tally_url}")
|
90
|
+
request = Net::HTTP::Post.new(uri)
|
91
|
+
request.content_type = 'application/xml' # Tally uses XML format
|
92
|
+
request.body = xml_payload
|
93
|
+
response = Net::HTTP.start(uri.hostname, uri.port) { |http| http.request(request) }
|
94
|
+
|
95
|
+
raise StandardError, response.body unless response.is_a?(Net::HTTPSuccess)
|
96
|
+
end
|
97
|
+
|
98
|
+
def convert_to_xml(record)
|
99
|
+
# Using Builder gem to create XML structure
|
100
|
+
xml = Builder::XmlMarkup.new
|
101
|
+
xml.instruct! :xml, version: '1.0', encoding: 'UTF-8'
|
102
|
+
xml.ENVELOPE do
|
103
|
+
xml.HEADER do
|
104
|
+
xml.TALLYREQUEST 'Import Data'
|
105
|
+
end
|
106
|
+
xml.BODY do
|
107
|
+
xml.IMPORTDATA do
|
108
|
+
xml.REQUESTDESC do
|
109
|
+
xml.REPORTNAME 'Vouchers'
|
110
|
+
xml.STATICVARIABLES do
|
111
|
+
xml.SVCURRENTCOMPANY @company_name
|
112
|
+
end
|
113
|
+
end
|
114
|
+
xml.REQUESTDATA do
|
115
|
+
xml.TALLYMESSAGE('xmlns:UDF' => 'TallyUDF') do
|
116
|
+
xml.VOUCHER('VCHTYPE' => 'Sales', 'ACTION' => 'Create', 'OBJVIEW' => 'Invoice Voucher View') do
|
117
|
+
xml.DATE(record[:date].gsub('-', '')) # Date in YYYYMMDD format
|
118
|
+
xml.PARTYNAME record[:customer_name]
|
119
|
+
xml.PARTYLEDGERNAME record[:customer_name]
|
120
|
+
xml.VOUCHERTYPENAME 'Sales'
|
121
|
+
xml.REFERENCE record[:invoice_number]
|
122
|
+
xml.VOUCHERNUMBER record[:invoice_id] # If you want to use invoice_id as VOUCHERNUMBER
|
123
|
+
xml.NARRATION 'Invoice for ' + record[:customer_name]
|
124
|
+
xml.BASICBASEPARTYNAME record[:customer_name]
|
125
|
+
|
126
|
+
# Inventory Allocations
|
127
|
+
xml.ALLINVENTORYENTRIES__LIST do
|
128
|
+
xml.STOCKITEMNAME 'Product A' # This should be replaced with actual product names
|
129
|
+
xml.ISDEEMEDPOSITIVE 'No'
|
130
|
+
xml.AMOUNT record[:total]
|
131
|
+
xml.BILLEDQTY '1' # Adjust quantity as needed
|
132
|
+
xml.RATE record[:total] # Adjust rate as needed
|
133
|
+
xml.ACTUALQTY '1'
|
134
|
+
xml.ACCOUNTINGALLOCATIONS__LIST do
|
135
|
+
xml.LEDGERNAME record[:customer_name]
|
136
|
+
xml.AMOUNT record[:total]
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# Ledger Entries (Tax and Sales Accounts)
|
141
|
+
xml.LEDGERENTRIES__LIST do
|
142
|
+
xml.LEDGERNAME 'Sales Accounts'
|
143
|
+
xml.ISDEEMEDPOSITIVE 'No'
|
144
|
+
xml.AMOUNT record[:total]
|
145
|
+
end
|
146
|
+
|
147
|
+
xml.LEDGERENTRIES__LIST do
|
148
|
+
xml.LEDGERNAME 'Output GST @ 18%' # Adjust GST ledger name if different
|
149
|
+
xml.ISDEEMEDPOSITIVE 'No'
|
150
|
+
xml.AMOUNT '900' # Replace with calculated GST if available
|
151
|
+
end
|
152
|
+
|
153
|
+
xml.LEDGERENTRIES__LIST do
|
154
|
+
xml.LEDGERNAME 'ABC India Pvt. Ltd.'
|
155
|
+
xml.ISDEEMEDPOSITIVE 'Yes'
|
156
|
+
xml.AMOUNT '-5000' # Adjust based on the payment received or invoice amount
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
xml.target! # Returns the generated XML string
|
165
|
+
end
|
166
|
+
|
167
|
+
# def convert_to_xml(record)
|
168
|
+
# # Using Builder gem to create XML structure
|
169
|
+
# xml = Builder::XmlMarkup.new
|
170
|
+
# xml.instruct! :xml, version: '1.0', encoding: 'UTF-8'
|
171
|
+
# xml.ENVELOPE do
|
172
|
+
# xml.HEADER do
|
173
|
+
# xml.TALLYREQUEST 'Import Data'
|
174
|
+
# end
|
175
|
+
# xml.BODY do
|
176
|
+
# xml.IMPORTDATA do
|
177
|
+
# xml.REQUESTDESC do
|
178
|
+
# xml.REPORTNAME 'Vouchers'
|
179
|
+
# xml.STATICVARIABLES do
|
180
|
+
# xml.SVCURRENTCOMPANY @company_name
|
181
|
+
# end
|
182
|
+
# end
|
183
|
+
# xml.REQUESTDATA do
|
184
|
+
# xml.TALLYMESSAGE('xmlns:UDF' => 'TallyUDF') do
|
185
|
+
# xml.VOUCHER do
|
186
|
+
# xml.DATE '20240915' # Static or dynamic date
|
187
|
+
# xml.VOUCHERTYPENAME 'Sales'
|
188
|
+
# xml.NARRATION 'Test invoice from ETL Tool'
|
189
|
+
# xml.VOUCHERNUMBER record[:VOUCHERNUMBER] || 'INV-1002'
|
190
|
+
# xml.PARTYNAME record[:PARTYNAME] || 'XYZ Ltd'
|
191
|
+
# xml.AMOUNT record[:AMOUNT] || 10000
|
192
|
+
# xml.LEDGERENTRIES__LIST do
|
193
|
+
# xml.LEDGERNAME 'Sales Account'
|
194
|
+
# xml.AMOUNT record[:AMOUNT] || 10000
|
195
|
+
# end
|
196
|
+
# end
|
197
|
+
# end
|
198
|
+
# end
|
199
|
+
# end
|
200
|
+
# end
|
201
|
+
# end
|
202
|
+
# xml.target! # Returns the generated XML string
|
203
|
+
# end
|
204
|
+
|
205
|
+
def authenticate_client
|
206
|
+
# Tally may not need specific authentication steps like OAuth;
|
207
|
+
# skipping authentication or implementing basic connection validation.
|
208
|
+
true
|
209
|
+
end
|
210
|
+
|
211
|
+
def success_status
|
212
|
+
ConnectionStatus.new(status: ConnectionStatusType["succeeded"]).to_multiwoven_message
|
213
|
+
end
|
214
|
+
|
215
|
+
def failure_status(error)
|
216
|
+
ConnectionStatus.new(status: ConnectionStatusType["failed"], message: error.message).to_multiwoven_message
|
217
|
+
end
|
218
|
+
|
219
|
+
def load_catalog
|
220
|
+
read_json(CATALOG_SPEC_PATH)
|
221
|
+
end
|
222
|
+
|
223
|
+
def tracking_message(success, failure)
|
224
|
+
Etl::Integrations::Protocol::TrackingMessage.new(
|
225
|
+
success: success, failed: failure
|
226
|
+
).to_multiwoven_message
|
227
|
+
end
|
228
|
+
|
229
|
+
def log_debug(message)
|
230
|
+
Etl::Integrations::Service.logger.debug(message)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
"request_rate_concurrency": 10,
|
5
5
|
"streams": [
|
6
6
|
{
|
7
|
-
"name": "
|
7
|
+
"name": "Sales Accounts",
|
8
8
|
"action": "create",
|
9
9
|
"json_schema": {
|
10
10
|
"type": "object",
|
@@ -26,6 +26,9 @@
|
|
26
26
|
"Debit Note"
|
27
27
|
]
|
28
28
|
},
|
29
|
+
"Particulars": {
|
30
|
+
"type": ["string", "null"]
|
31
|
+
},
|
29
32
|
"Date": {
|
30
33
|
"type": "string",
|
31
34
|
"format": "date"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
3
|
-
"title": "
|
3
|
+
"title": "Etl Protocol",
|
4
4
|
"type": "object",
|
5
|
-
"description": "
|
5
|
+
"description": "Etl protocol schema",
|
6
6
|
"version": "1.0.0",
|
7
7
|
"definitions": {
|
8
8
|
"SyncMode": {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module Etl
|
4
4
|
module Integrations::Protocol
|
5
5
|
module Types
|
6
6
|
include Dry.Types()
|
@@ -28,7 +28,7 @@ module Multiwoven
|
|
28
28
|
SchemaMode = Types::String.enum("schema", "schemaless")
|
29
29
|
|
30
30
|
class ProtocolModel < Dry::Struct
|
31
|
-
extend
|
31
|
+
extend Etl::Integrations::Core::Utils
|
32
32
|
class << self
|
33
33
|
def from_json(json_string)
|
34
34
|
data = JSON.parse(json_string)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module Etl
|
4
4
|
module Integrations
|
5
5
|
class Service
|
6
6
|
def initialize
|
@@ -21,12 +21,12 @@ module Multiwoven
|
|
21
21
|
def connector_class(connector_type, connector_name)
|
22
22
|
# *args
|
23
23
|
Object.const_get(
|
24
|
-
"
|
24
|
+
"Etl::Integrations::#{connector_type}::#{connector_name}::Client"
|
25
25
|
)
|
26
26
|
|
27
27
|
# # Retrieve the class dynamically
|
28
28
|
# klass = Object.const_get(
|
29
|
-
# "
|
29
|
+
# "Etl::Integrations::#{connector_type}::#{connector_name}::Client"
|
30
30
|
# )
|
31
31
|
|
32
32
|
# # Instantiate the class (assuming it's not a singleton)
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require "google/cloud/bigquery"
|
4
4
|
|
5
|
-
module
|
5
|
+
module Etl::Integrations::Source
|
6
6
|
module Bigquery
|
7
|
-
include
|
7
|
+
include Etl::Integrations::Core
|
8
8
|
class Client < SourceConnector
|
9
9
|
def check_connection(connection_config)
|
10
10
|
connection_config = connection_config.with_indifferent_access
|
@@ -81,7 +81,7 @@ module Multiwoven::Integrations::Source
|
|
81
81
|
|
82
82
|
def create_streams(records)
|
83
83
|
group_by_table(records).map do |r|
|
84
|
-
|
84
|
+
Etl::Integrations::Protocol::Stream.new(name: r[:tablename], action: StreamAction["fetch"], json_schema: convert_to_json_schema(r[:columns]))
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module Etl::Integrations::Source
|
4
4
|
module Databricks
|
5
|
-
include
|
5
|
+
include Etl::Integrations::Core
|
6
6
|
class Client < SourceConnector
|
7
7
|
def check_connection(connection_config)
|
8
8
|
connection_config = connection_config.with_indifferent_access
|
@@ -81,7 +81,7 @@ module Multiwoven::Integrations::Source
|
|
81
81
|
|
82
82
|
def create_streams(records)
|
83
83
|
group_by_table(records).map do |r|
|
84
|
-
|
84
|
+
Etl::Integrations::Protocol::Stream.new(name: r[:tablename], action: StreamAction["fetch"], json_schema: convert_to_json_schema(r[:columns]))
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require "pg"
|
4
4
|
|
5
|
-
module
|
5
|
+
module Etl::Integrations::Source
|
6
6
|
module Postgresql
|
7
|
-
include
|
7
|
+
include Etl::Integrations::Core
|
8
8
|
class Client < SourceConnector
|
9
9
|
def check_connection(connection_config)
|
10
10
|
connection_config = connection_config.with_indifferent_access
|
@@ -86,7 +86,7 @@ module Multiwoven::Integrations::Source
|
|
86
86
|
|
87
87
|
def create_streams(records)
|
88
88
|
group_by_table(records).map do |r|
|
89
|
-
|
89
|
+
Etl::Integrations::Protocol::Stream.new(name: r[:tablename], action: StreamAction["fetch"], json_schema: convert_to_json_schema(r[:columns]))
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require "pg"
|
4
4
|
|
5
|
-
module
|
5
|
+
module Etl::Integrations::Source
|
6
6
|
module Redshift
|
7
|
-
include
|
7
|
+
include Etl::Integrations::Core
|
8
8
|
class Client < SourceConnector
|
9
9
|
def check_connection(connection_config)
|
10
10
|
connection_config = connection_config.with_indifferent_access
|
@@ -86,7 +86,7 @@ module Multiwoven::Integrations::Source
|
|
86
86
|
|
87
87
|
def create_streams(records)
|
88
88
|
group_by_table(records).map do |r|
|
89
|
-
|
89
|
+
Etl::Integrations::Protocol::Stream.new(name: r[:tablename], action: StreamAction["fetch"], json_schema: convert_to_json_schema(r[:columns]))
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -3,17 +3,17 @@
|
|
3
3
|
require "stringio"
|
4
4
|
require_relative "schema_helper"
|
5
5
|
|
6
|
-
module
|
6
|
+
module Etl
|
7
7
|
module Integrations
|
8
8
|
module Source
|
9
9
|
module SalesforceConsumerGoodsCloud
|
10
|
-
include
|
10
|
+
include Etl::Integrations::Core
|
11
11
|
|
12
12
|
API_VERSION = "59.0"
|
13
13
|
SALESFORCE_OBJECTS = %w[Account User Visit RetailStore RecordType].freeze
|
14
14
|
|
15
15
|
class Client < SourceConnector
|
16
|
-
prepend
|
16
|
+
prepend Etl::Integrations::Core::RateLimiter
|
17
17
|
def check_connection(connection_config)
|
18
18
|
connection_config = connection_config.with_indifferent_access
|
19
19
|
initialize_client(connection_config)
|
@@ -108,13 +108,13 @@ module Multiwoven
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def tracking_message(success, failure)
|
111
|
-
|
111
|
+
Etl::Integrations::Protocol::TrackingMessage.new(
|
112
112
|
success: success, failed: failure
|
113
113
|
).to_multiwoven_message
|
114
114
|
end
|
115
115
|
|
116
116
|
def log_debug(message)
|
117
|
-
|
117
|
+
Etl::Integrations::Service.logger.debug(message)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
3
|
+
module Etl::Integrations::Source
|
4
4
|
module Snowflake
|
5
|
-
include
|
5
|
+
include Etl::Integrations::Core
|
6
6
|
class Client < SourceConnector
|
7
7
|
def check_connection(connection_config)
|
8
8
|
connection_config = connection_config.with_indifferent_access
|
@@ -75,7 +75,7 @@ module Multiwoven::Integrations::Source
|
|
75
75
|
|
76
76
|
def create_streams(records)
|
77
77
|
group_by_table(records).map do |r|
|
78
|
-
|
78
|
+
Etl::Integrations::Protocol::Stream.new(name: r[:tablename], action: StreamAction["fetch"], json_schema: convert_to_json_schema(r[:columns]))
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -3,14 +3,14 @@
|
|
3
3
|
# require "zoho_books" # or the correct gem for Zoho Books
|
4
4
|
require "stringio"
|
5
5
|
|
6
|
-
module
|
6
|
+
module Etl
|
7
7
|
module Integrations
|
8
8
|
module Source
|
9
9
|
module ZohoBooks
|
10
|
-
include
|
10
|
+
include Etl::Integrations::Core
|
11
11
|
|
12
12
|
class Client < DestinationConnector
|
13
|
-
prepend
|
13
|
+
prepend Etl::Integrations::Core::RateLimiter
|
14
14
|
|
15
15
|
def check_connection(connection_config)
|
16
16
|
connection_config = connection_config.with_indifferent_access
|
@@ -140,13 +140,13 @@ module Multiwoven
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def tracking_message(success, failure)
|
143
|
-
|
143
|
+
Etl::Integrations::Protocol::TrackingMessage.new(
|
144
144
|
success: success, failed: failure
|
145
145
|
).to_multiwoven_message
|
146
146
|
end
|
147
147
|
|
148
148
|
def log_debug(message)
|
149
|
-
|
149
|
+
Etl::Integrations::Service.logger.debug(message)
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
@@ -63,7 +63,7 @@ require_relative "integrations/destination/sftp/client"
|
|
63
63
|
require_relative "integrations/destination/postgresql/client"
|
64
64
|
require_relative "integrations/destination/tally/client"
|
65
65
|
|
66
|
-
module
|
66
|
+
module Etl
|
67
67
|
module Integrations
|
68
68
|
class Error < StandardError; end
|
69
69
|
# Your code goes here...
|