multiwoven-integrations 0.18.1 → 0.18.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 872d35288639a0863bbe3e91a7413fd19194a60059155231c3afeb5bcc5710b4
|
4
|
+
data.tar.gz: f3237a02c7905a654a14074879215722bd9fc46fb62a5508a0511fd9dff2123e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeebc66382aaf4c99c92940e7011a8f0f13fee3ade624e0e93ba98cd8c652368f90e485a92f4e1c526f543dc49beb48469d5642c1d86ab8e17fce14ee50521e7
|
7
|
+
data.tar.gz: 918f48630ce40ad37f0fd86bae8708a18646bc531abe88a844ae18c2ce06b759b942da4fd7c45947384df27629e733eab4288739eb611e3904efd22e2385a084
|
@@ -86,15 +86,9 @@ module Multiwoven::Integrations::Source
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def query(conn, query)
|
89
|
-
query_regex = /\ASELECT\s+(?<columns>[\w,\s]+)\s+FROM\s+\w+\s*(?:LIMIT\s+(?<limit>\d+))?\s*(?:OFFSET\s+(?<offset>\d+))?\z/i
|
90
|
-
match = query.match(query_regex)
|
91
|
-
columns = match[:columns] || "*"
|
92
|
-
offset = match[:offset].to_i || 0
|
93
|
-
limit = match[:limit]&.to_i || nil
|
94
89
|
@sftp.download!(@remote_file_path, @tempfile.path)
|
95
|
-
|
96
|
-
|
97
|
-
records = get_results(conn, adjusted_query)
|
90
|
+
query = query.gsub(/FROM\s+\S+/i, "FROM read_csv_auto('#{@tempfile.path}')") if query.match?(/\bFROM\b/i)
|
91
|
+
records = get_results(conn, query)
|
98
92
|
records.map do |row|
|
99
93
|
RecordMessage.new(data: row, emitted_at: Time.now.to_i).to_multiwoven_message
|
100
94
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
"connection_specification": {
|
5
5
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
6
6
|
"title": "SFTP",
|
7
|
-
"required": ["host", "username", "password", "file_path", "format_type" ],
|
7
|
+
"required": ["host", "username", "password", "file_path", "file_name", "format_type" ],
|
8
8
|
"properties": {
|
9
9
|
"host": {
|
10
10
|
"title": "Host",
|