dwh 0.1.0
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 +7 -0
- data/.rubocop.yml +36 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +21 -0
- data/README.md +130 -0
- data/Rakefile +42 -0
- data/docs/DWH/Adapters/Adapter.html +3053 -0
- data/docs/DWH/Adapters/Athena.html +1704 -0
- data/docs/DWH/Adapters/Boolean.html +121 -0
- data/docs/DWH/Adapters/Druid.html +1626 -0
- data/docs/DWH/Adapters/DuckDb.html +2012 -0
- data/docs/DWH/Adapters/MySql.html +1704 -0
- data/docs/DWH/Adapters/OpenAuthorizable/ClassMethods.html +265 -0
- data/docs/DWH/Adapters/OpenAuthorizable.html +1102 -0
- data/docs/DWH/Adapters/Postgres.html +2000 -0
- data/docs/DWH/Adapters/Snowflake.html +1662 -0
- data/docs/DWH/Adapters/SqlServer.html +2084 -0
- data/docs/DWH/Adapters/Trino.html +1835 -0
- data/docs/DWH/Adapters.html +129 -0
- data/docs/DWH/AuthenticationError.html +142 -0
- data/docs/DWH/Behaviors.html +767 -0
- data/docs/DWH/Capabilities.html +748 -0
- data/docs/DWH/Column.html +1115 -0
- data/docs/DWH/ConfigError.html +143 -0
- data/docs/DWH/ConnectionError.html +143 -0
- data/docs/DWH/DWHError.html +138 -0
- data/docs/DWH/ExecutionError.html +143 -0
- data/docs/DWH/Factory.html +1133 -0
- data/docs/DWH/Functions/Arrays.html +505 -0
- data/docs/DWH/Functions/Dates.html +1644 -0
- data/docs/DWH/Functions/ExtractDatePart.html +804 -0
- data/docs/DWH/Functions/Nulls.html +377 -0
- data/docs/DWH/Functions.html +846 -0
- data/docs/DWH/Logger.html +258 -0
- data/docs/DWH/OAuthError.html +138 -0
- data/docs/DWH/Settings.html +658 -0
- data/docs/DWH/StreamingStats.html +804 -0
- data/docs/DWH/Table.html +1260 -0
- data/docs/DWH/TableStats.html +583 -0
- data/docs/DWH/TokenExpiredError.html +142 -0
- data/docs/DWH/UnsupportedCapability.html +135 -0
- data/docs/DWH.html +220 -0
- data/docs/_index.html +471 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +503 -0
- data/docs/file.README.html +210 -0
- data/docs/file.adapters.html +514 -0
- data/docs/file.creating-adapters.html +497 -0
- data/docs/file.getting-started.html +288 -0
- data/docs/file.usage.html +446 -0
- data/docs/file_list.html +79 -0
- data/docs/frames.html +22 -0
- data/docs/guides/adapters.md +445 -0
- data/docs/guides/creating-adapters.md +430 -0
- data/docs/guides/getting-started.md +225 -0
- data/docs/guides/usage.md +378 -0
- data/docs/index.html +210 -0
- data/docs/js/app.js +344 -0
- data/docs/js/full_list.js +242 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +2038 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/dwh/adapters/athena.rb +359 -0
- data/lib/dwh/adapters/druid.rb +267 -0
- data/lib/dwh/adapters/duck_db.rb +235 -0
- data/lib/dwh/adapters/my_sql.rb +235 -0
- data/lib/dwh/adapters/open_authorizable.rb +215 -0
- data/lib/dwh/adapters/postgres.rb +250 -0
- data/lib/dwh/adapters/snowflake.rb +489 -0
- data/lib/dwh/adapters/sql_server.rb +257 -0
- data/lib/dwh/adapters/trino.rb +213 -0
- data/lib/dwh/adapters.rb +363 -0
- data/lib/dwh/behaviors.rb +67 -0
- data/lib/dwh/capabilities.rb +39 -0
- data/lib/dwh/column.rb +79 -0
- data/lib/dwh/errors.rb +29 -0
- data/lib/dwh/factory.rb +125 -0
- data/lib/dwh/functions/arrays.rb +42 -0
- data/lib/dwh/functions/dates.rb +162 -0
- data/lib/dwh/functions/extract_date_part.rb +70 -0
- data/lib/dwh/functions/nulls.rb +31 -0
- data/lib/dwh/functions.rb +86 -0
- data/lib/dwh/logger.rb +50 -0
- data/lib/dwh/settings/athena.yml +77 -0
- data/lib/dwh/settings/base.yml +81 -0
- data/lib/dwh/settings/databricks.yml +51 -0
- data/lib/dwh/settings/druid.yml +59 -0
- data/lib/dwh/settings/duckdb.yml +44 -0
- data/lib/dwh/settings/mysql.yml +67 -0
- data/lib/dwh/settings/postgres.yml +30 -0
- data/lib/dwh/settings/redshift.yml +52 -0
- data/lib/dwh/settings/snowflake.yml +45 -0
- data/lib/dwh/settings/sqlserver.yml +80 -0
- data/lib/dwh/settings/trino.yml +77 -0
- data/lib/dwh/settings.rb +79 -0
- data/lib/dwh/streaming_stats.rb +69 -0
- data/lib/dwh/table.rb +105 -0
- data/lib/dwh/table_stats.rb +51 -0
- data/lib/dwh/version.rb +5 -0
- data/lib/dwh.rb +54 -0
- data/sig/dwh.rbs +4 -0
- metadata +231 -0
@@ -0,0 +1,1835 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: DWH::Adapters::Trino
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.37
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "DWH::Adapters::Trino";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (T)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../DWH.html" title="DWH (module)">DWH</a></span></span> » <span class='title'><span class='object_link'><a href="../Adapters.html" title="DWH::Adapters (module)">Adapters</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Trino</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: DWH::Adapters::Trino
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="Adapter.html" title="DWH::Adapters::Adapter (class)">Adapter</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="Adapter.html" title="DWH::Adapters::Adapter (class)">Adapter</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">DWH::Adapters::Trino</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/dwh/adapters/trino.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
<p>Trino adapter. This should work for Presto as well.
|
107
|
+
This adapter requires the <a href="https://github.com/treasure-data/trino-client-ruby" target="_parent" title="trino-client-ruby">trino-client-ruby</a> gem.</p>
|
108
|
+
|
109
|
+
<p>Create adatper instances using <span class='object_link'><a href="../Factory.html#create-instance_method" title="DWH::Factory#create (method)">DWH.create</a></span>.</p>
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
<div class="tags">
|
115
|
+
|
116
|
+
<div class="examples">
|
117
|
+
<h4 class="tag_title">Examples:</h4>
|
118
|
+
|
119
|
+
|
120
|
+
<h5 class="example_title"><div class='inline'><p>Basic connection with required only options</p>
|
121
|
+
</div></h5>
|
122
|
+
|
123
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../../DWH.html" title="DWH (module)">DWH</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create'><span class='object_link'><a href="../Factory.html#create-instance_method" title="DWH::Factory#create (method)">create</a></span></span><span class='lparen'>(</span><span class='symbol'>:trino</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>host:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>localhost</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>catalog:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>native</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>username:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Ajo</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='rparen'>)</span></code></pre>
|
124
|
+
|
125
|
+
|
126
|
+
<h5 class="example_title"><div class='inline'><p>Connect with extra http headers</p>
|
127
|
+
</div></h5>
|
128
|
+
|
129
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../../DWH.html" title="DWH (module)">DWH</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create'><span class='object_link'><a href="../Factory.html#create-instance_method" title="DWH::Factory#create (method)">create</a></span></span><span class='lparen'>(</span><span class='symbol'>:trino</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>host:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>localhost</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>port:</span> <span class='int'>8080</span><span class='comma'>,</span>
|
130
|
+
<span class='label'>catalog:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>native</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>username:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Ajo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
131
|
+
<span class='label'>extra_connection_params:</span> <span class='lbrace'>{</span>
|
132
|
+
<span class='label'>http_headers:</span> <span class='lbrace'>{</span>
|
133
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>X-Trino-User</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>True User Name</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
134
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>X-Forwarded-Request</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'><request passed down from client</span><span class='tstring_end'>'</span></span>
|
135
|
+
<span class='rbrace'>}</span>
|
136
|
+
<span class='rbrace'>}</span>
|
137
|
+
<span class='rbrace'>}</span><span class='rparen'>)</span></code></pre>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
<h2>Constant Summary</h2>
|
146
|
+
|
147
|
+
<h3 class="inherited">Constants included
|
148
|
+
from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
149
|
+
<p class="inherited"><span class='object_link'><a href="../Settings.html#BASE_SETTINGS_FILE-constant" title="DWH::Settings::BASE_SETTINGS_FILE (constant)">Settings::BASE_SETTINGS_FILE</a></span></p>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<h3 class="inherited">Constants included
|
154
|
+
from <span class='object_link'><a href="../Functions/Dates.html" title="DWH::Functions::Dates (module)">Functions::Dates</a></span></h3>
|
155
|
+
<p class="inherited"><span class='object_link'><a href="../Functions/Dates.html#DATE_CLASSES-constant" title="DWH::Functions::Dates::DATE_CLASSES (constant)">Functions::Dates::DATE_CLASSES</a></span>, <span class='object_link'><a href="../Functions/Dates.html#TIMESTAMPABLE_UNITS-constant" title="DWH::Functions::Dates::TIMESTAMPABLE_UNITS (constant)">Functions::Dates::TIMESTAMPABLE_UNITS</a></span></p>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<h2>Instance Attribute Summary</h2>
|
161
|
+
|
162
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Adapter.html" title="DWH::Adapters::Adapter (class)">Adapter</a></span></h3>
|
163
|
+
<p class="inherited"><span class='object_link'><a href="Adapter.html#config-instance_method" title="DWH::Adapters::Adapter#config (method)">#config</a></span>, <span class='object_link'><a href="Adapter.html#settings-instance_method" title="DWH::Adapters::Adapter#settings (method)">#settings</a></span></p>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<h3 class="inherited">Attributes included from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
168
|
+
<p class="inherited"><span class='object_link'><a href="../Settings.html#adapter_settings-instance_method" title="DWH::Settings#adapter_settings (method)">#adapter_settings</a></span></p>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<h2>
|
173
|
+
Instance Method Summary
|
174
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
175
|
+
</h2>
|
176
|
+
|
177
|
+
<ul class="summary">
|
178
|
+
|
179
|
+
<li class="public ">
|
180
|
+
<span class="summary_signature">
|
181
|
+
|
182
|
+
<a href="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong> ⇒ Object </a>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
</span>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<span class="summary_desc"><div class='inline'>
|
197
|
+
</div></span>
|
198
|
+
|
199
|
+
</li>
|
200
|
+
|
201
|
+
|
202
|
+
<li class="public ">
|
203
|
+
<span class="summary_signature">
|
204
|
+
|
205
|
+
<a href="#execute-instance_method" title="#execute (instance method)">#<strong>execute</strong>(sql, format: :array, retries: 2) ⇒ Array<Array>, ... </a>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
</span>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<span class="summary_desc"><div class='inline'><p>Execute sql on the target database.</p>
|
220
|
+
</div></span>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
|
225
|
+
<li class="public ">
|
226
|
+
<span class="summary_signature">
|
227
|
+
|
228
|
+
<a href="#execute_stream-instance_method" title="#execute_stream (instance method)">#<strong>execute_stream</strong>(sql, io, stats: nil, retries: 1) ⇒ IO </a>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</span>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<span class="summary_desc"><div class='inline'><p>Execute sql and stream responses back.</p>
|
243
|
+
</div></span>
|
244
|
+
|
245
|
+
</li>
|
246
|
+
|
247
|
+
|
248
|
+
<li class="public ">
|
249
|
+
<span class="summary_signature">
|
250
|
+
|
251
|
+
<a href="#metadata-instance_method" title="#metadata (instance method)">#<strong>metadata</strong>(table, **qualifiers) ⇒ DWH::Table </a>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
</span>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<span class="summary_desc"><div class='inline'><p>Get the schema structure of a given a given table_name.</p>
|
266
|
+
</div></span>
|
267
|
+
|
268
|
+
</li>
|
269
|
+
|
270
|
+
|
271
|
+
<li class="public ">
|
272
|
+
<span class="summary_signature">
|
273
|
+
|
274
|
+
<a href="#schema%3F-instance_method" title="#schema? (instance method)">#<strong>schema?</strong> ⇒ Boolean </a>
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
</span>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<span class="summary_desc"><div class='inline'>
|
289
|
+
</div></span>
|
290
|
+
|
291
|
+
</li>
|
292
|
+
|
293
|
+
|
294
|
+
<li class="public ">
|
295
|
+
<span class="summary_signature">
|
296
|
+
|
297
|
+
<a href="#stats-instance_method" title="#stats (instance method)">#<strong>stats</strong>(table, date_column: nil, **qualifiers) ⇒ DWH::Table </a>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
</span>
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
<span class="summary_desc"><div class='inline'><p>Returns basic stats of a given table.</p>
|
312
|
+
</div></span>
|
313
|
+
|
314
|
+
</li>
|
315
|
+
|
316
|
+
|
317
|
+
<li class="public ">
|
318
|
+
<span class="summary_signature">
|
319
|
+
|
320
|
+
<a href="#stream-instance_method" title="#stream (instance method)">#<strong>stream</strong>(sql) {|chunk| ... } ⇒ Object </a>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
</span>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
<span class="summary_desc"><div class='inline'><p>Executes the given sql and yields the streamed results to the given block.</p>
|
335
|
+
</div></span>
|
336
|
+
|
337
|
+
</li>
|
338
|
+
|
339
|
+
|
340
|
+
<li class="public ">
|
341
|
+
<span class="summary_signature">
|
342
|
+
|
343
|
+
<a href="#table%3F-instance_method" title="#table? (instance method)">#<strong>table?</strong>(table, **qualifiers) ⇒ Boolean </a>
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
</span>
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
<span class="summary_desc"><div class='inline'><p>Check if table exists in remote db.</p>
|
358
|
+
</div></span>
|
359
|
+
|
360
|
+
</li>
|
361
|
+
|
362
|
+
|
363
|
+
<li class="public ">
|
364
|
+
<span class="summary_signature">
|
365
|
+
|
366
|
+
<a href="#tables-instance_method" title="#tables (instance method)">#<strong>tables</strong>(**qualifiers) ⇒ Array<String> </a>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
</span>
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
<span class="summary_desc"><div class='inline'><p>Get all tables available in the target db.</p>
|
381
|
+
</div></span>
|
382
|
+
|
383
|
+
</li>
|
384
|
+
|
385
|
+
|
386
|
+
<li class="public ">
|
387
|
+
<span class="summary_signature">
|
388
|
+
|
389
|
+
<a href="#test_connection-instance_method" title="#test_connection (instance method)">#<strong>test_connection</strong>(raise_exception: false) ⇒ Object </a>
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
</span>
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
<span class="summary_desc"><div class='inline'>
|
404
|
+
</div></span>
|
405
|
+
|
406
|
+
</li>
|
407
|
+
|
408
|
+
|
409
|
+
<li class="public ">
|
410
|
+
<span class="summary_signature">
|
411
|
+
|
412
|
+
<a href="#valid_config%3F-instance_method" title="#valid_config? (instance method)">#<strong>valid_config?</strong> ⇒ Boolean </a>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
</span>
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
<span class="summary_desc"><div class='inline'>
|
427
|
+
</div></span>
|
428
|
+
|
429
|
+
</li>
|
430
|
+
|
431
|
+
|
432
|
+
</ul>
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Adapter.html" title="DWH::Adapters::Adapter (class)">Adapter</a></span></h3>
|
445
|
+
<p class="inherited"><span class='object_link'><a href="Adapter.html#adapter_name-instance_method" title="DWH::Adapters::Adapter#adapter_name (method)">#adapter_name</a></span>, <span class='object_link'><a href="Adapter.html#alter_settings-instance_method" title="DWH::Adapters::Adapter#alter_settings (method)">#alter_settings</a></span>, <span class='object_link'><a href="Adapter.html#close-instance_method" title="DWH::Adapters::Adapter#close (method)">#close</a></span>, <span class='object_link'><a href="Adapter.html#config-class_method" title="DWH::Adapters::Adapter.config (method)">config</a></span>, <span class='object_link'><a href="Adapter.html#configuration-class_method" title="DWH::Adapters::Adapter.configuration (method)">configuration</a></span>, <span class='object_link'><a href="Adapter.html#connect!-instance_method" title="DWH::Adapters::Adapter#connect! (method)">#connect!</a></span>, <span class='object_link'><a href="Adapter.html#connect%3F-instance_method" title="DWH::Adapters::Adapter#connect? (method)">#connect?</a></span>, <span class='object_link'><a href="Adapter.html#extra_connection_params-instance_method" title="DWH::Adapters::Adapter#extra_connection_params (method)">#extra_connection_params</a></span>, <span class='object_link'><a href="Adapter.html#extra_query_params-instance_method" title="DWH::Adapters::Adapter#extra_query_params (method)">#extra_query_params</a></span>, <span class='object_link'><a href="Adapter.html#initialize-instance_method" title="DWH::Adapters::Adapter#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Adapter.html#reset_settings-instance_method" title="DWH::Adapters::Adapter#reset_settings (method)">#reset_settings</a></span>, <span class='object_link'><a href="Adapter.html#token_expired%3F-instance_method" title="DWH::Adapters::Adapter#token_expired? (method)">#token_expired?</a></span>, <span class='object_link'><a href="Adapter.html#with_debug-instance_method" title="DWH::Adapters::Adapter#with_debug (method)">#with_debug</a></span>, <span class='object_link'><a href="Adapter.html#with_retry-instance_method" title="DWH::Adapters::Adapter#with_retry (method)">#with_retry</a></span></p>
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
456
|
+
<p class="inherited"><span class='object_link'><a href="../Settings.html#adapter_name-instance_method" title="DWH::Settings#adapter_name (method)">#adapter_name</a></span>, <span class='object_link'><a href="../Settings.html#load_settings-instance_method" title="DWH::Settings#load_settings (method)">#load_settings</a></span>, <span class='object_link'><a href="../Settings.html#settings_file-instance_method" title="DWH::Settings#settings_file (method)">#settings_file</a></span>, <span class='object_link'><a href="../Settings.html#settings_file_path-instance_method" title="DWH::Settings#settings_file_path (method)">#settings_file_path</a></span>, <span class='object_link'><a href="../Settings.html#using_base_settings%3F-instance_method" title="DWH::Settings#using_base_settings? (method)">#using_base_settings?</a></span></p>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Logger.html" title="DWH::Logger (module)">Logger</a></span></h3>
|
467
|
+
<p class="inherited"><span class='object_link'><a href="../Logger.html#logger-instance_method" title="DWH::Logger#logger (method)">#logger</a></span>, <span class='object_link'><a href="../Logger.html#logger-class_method" title="DWH::Logger.logger (method)">logger</a></span></p>
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Behaviors.html" title="DWH::Behaviors (module)">Behaviors</a></span></h3>
|
478
|
+
<p class="inherited"><span class='object_link'><a href="../Behaviors.html#apply_advanced_filtering_on_array_projections%3F-instance_method" title="DWH::Behaviors#apply_advanced_filtering_on_array_projections? (method)">#apply_advanced_filtering_on_array_projections?</a></span>, <span class='object_link'><a href="../Behaviors.html#cross_universe_measure_filtering_strategy-instance_method" title="DWH::Behaviors#cross_universe_measure_filtering_strategy (method)">#cross_universe_measure_filtering_strategy</a></span>, <span class='object_link'><a href="../Behaviors.html#extend_ending_date_to_last_hour_of_day%3F-instance_method" title="DWH::Behaviors#extend_ending_date_to_last_hour_of_day? (method)">#extend_ending_date_to_last_hour_of_day?</a></span>, <span class='object_link'><a href="../Behaviors.html#final_measure_filter%3F-instance_method" title="DWH::Behaviors#final_measure_filter? (method)">#final_measure_filter?</a></span>, <span class='object_link'><a href="../Behaviors.html#final_pass_measure_join_type-instance_method" title="DWH::Behaviors#final_pass_measure_join_type (method)">#final_pass_measure_join_type</a></span>, <span class='object_link'><a href="../Behaviors.html#greedy_apply_date_filters-instance_method" title="DWH::Behaviors#greedy_apply_date_filters (method)">#greedy_apply_date_filters</a></span>, <span class='object_link'><a href="../Behaviors.html#intermediate_measure_filter%3F-instance_method" title="DWH::Behaviors#intermediate_measure_filter? (method)">#intermediate_measure_filter?</a></span>, <span class='object_link'><a href="../Behaviors.html#temp_table_prefix-instance_method" title="DWH::Behaviors#temp_table_prefix (method)">#temp_table_prefix</a></span>, <span class='object_link'><a href="../Behaviors.html#temp_table_type-instance_method" title="DWH::Behaviors#temp_table_type (method)">#temp_table_type</a></span></p>
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Functions.html" title="DWH::Functions (module)">Functions</a></span></h3>
|
489
|
+
<p class="inherited"><span class='object_link'><a href="../Functions.html#cast-instance_method" title="DWH::Functions#cast (method)">#cast</a></span>, <span class='object_link'><a href="../Functions.html#cross_join-instance_method" title="DWH::Functions#cross_join (method)">#cross_join</a></span>, <span class='object_link'><a href="../Functions.html#gsk-instance_method" title="DWH::Functions#gsk (method)">#gsk</a></span>, <span class='object_link'><a href="../Functions.html#lower_case-instance_method" title="DWH::Functions#lower_case (method)">#lower_case</a></span>, <span class='object_link'><a href="../Functions.html#quote-instance_method" title="DWH::Functions#quote (method)">#quote</a></span>, <span class='object_link'><a href="../Functions.html#string_lit-instance_method" title="DWH::Functions#string_lit (method)">#string_lit</a></span>, <span class='object_link'><a href="../Functions.html#trim-instance_method" title="DWH::Functions#trim (method)">#trim</a></span>, <span class='object_link'><a href="../Functions.html#upper_case-instance_method" title="DWH::Functions#upper_case (method)">#upper_case</a></span></p>
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Functions/Arrays.html" title="DWH::Functions::Arrays (module)">Functions::Arrays</a></span></h3>
|
500
|
+
<p class="inherited"><span class='object_link'><a href="../Functions/Arrays.html#array_exclude_list-instance_method" title="DWH::Functions::Arrays#array_exclude_list (method)">#array_exclude_list</a></span>, <span class='object_link'><a href="../Functions/Arrays.html#array_in_list-instance_method" title="DWH::Functions::Arrays#array_in_list (method)">#array_in_list</a></span>, <span class='object_link'><a href="../Functions/Arrays.html#array_unnest_join-instance_method" title="DWH::Functions::Arrays#array_unnest_join (method)">#array_unnest_join</a></span></p>
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Functions/Nulls.html" title="DWH::Functions::Nulls (module)">Functions::Nulls</a></span></h3>
|
511
|
+
<p class="inherited"><span class='object_link'><a href="../Functions/Nulls.html#if_null-instance_method" title="DWH::Functions::Nulls#if_null (method)">#if_null</a></span>, <span class='object_link'><a href="../Functions/Nulls.html#null_if-instance_method" title="DWH::Functions::Nulls#null_if (method)">#null_if</a></span>, <span class='object_link'><a href="../Functions/Nulls.html#null_if_zero-instance_method" title="DWH::Functions::Nulls#null_if_zero (method)">#null_if_zero</a></span></p>
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Functions/ExtractDatePart.html" title="DWH::Functions::ExtractDatePart (module)">Functions::ExtractDatePart</a></span></h3>
|
522
|
+
<p class="inherited"><span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_day_name-instance_method" title="DWH::Functions::ExtractDatePart#extract_day_name (method)">#extract_day_name</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_day_of_month-instance_method" title="DWH::Functions::ExtractDatePart#extract_day_of_month (method)">#extract_day_of_month</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_day_of_week-instance_method" title="DWH::Functions::ExtractDatePart#extract_day_of_week (method)">#extract_day_of_week</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_day_of_year-instance_method" title="DWH::Functions::ExtractDatePart#extract_day_of_year (method)">#extract_day_of_year</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_hour-instance_method" title="DWH::Functions::ExtractDatePart#extract_hour (method)">#extract_hour</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_minute-instance_method" title="DWH::Functions::ExtractDatePart#extract_minute (method)">#extract_minute</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_month-instance_method" title="DWH::Functions::ExtractDatePart#extract_month (method)">#extract_month</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_month_name-instance_method" title="DWH::Functions::ExtractDatePart#extract_month_name (method)">#extract_month_name</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_quarter-instance_method" title="DWH::Functions::ExtractDatePart#extract_quarter (method)">#extract_quarter</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_week_of_year-instance_method" title="DWH::Functions::ExtractDatePart#extract_week_of_year (method)">#extract_week_of_year</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_year-instance_method" title="DWH::Functions::ExtractDatePart#extract_year (method)">#extract_year</a></span>, <span class='object_link'><a href="../Functions/ExtractDatePart.html#extract_year_month-instance_method" title="DWH::Functions::ExtractDatePart#extract_year_month (method)">#extract_year_month</a></span></p>
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Functions/Dates.html" title="DWH::Functions::Dates (module)">Functions::Dates</a></span></h3>
|
533
|
+
<p class="inherited"><span class='object_link'><a href="../Functions/Dates.html#adjust_week_start_day-instance_method" title="DWH::Functions::Dates#adjust_week_start_day (method)">#adjust_week_start_day</a></span>, <span class='object_link'><a href="../Functions/Dates.html#adjust_week_start_day%3F-instance_method" title="DWH::Functions::Dates#adjust_week_start_day? (method)">#adjust_week_start_day?</a></span>, <span class='object_link'><a href="../Functions/Dates.html#current_date-instance_method" title="DWH::Functions::Dates#current_date (method)">#current_date</a></span>, <span class='object_link'><a href="../Functions/Dates.html#current_time-instance_method" title="DWH::Functions::Dates#current_time (method)">#current_time</a></span>, <span class='object_link'><a href="../Functions/Dates.html#current_timestamp-instance_method" title="DWH::Functions::Dates#current_timestamp (method)">#current_timestamp</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_add-instance_method" title="DWH::Functions::Dates#date_add (method)">#date_add</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_data_type-instance_method" title="DWH::Functions::Dates#date_data_type (method)">#date_data_type</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_diff-instance_method" title="DWH::Functions::Dates#date_diff (method)">#date_diff</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_format-instance_method" title="DWH::Functions::Dates#date_format (method)">#date_format</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_format_sql-instance_method" title="DWH::Functions::Dates#date_format_sql (method)">#date_format_sql</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_int%3F-instance_method" title="DWH::Functions::Dates#date_int? (method)">#date_int?</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_literal-instance_method" title="DWH::Functions::Dates#date_literal (method)">#date_literal</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_time_format-instance_method" title="DWH::Functions::Dates#date_time_format (method)">#date_time_format</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_time_literal-instance_method" title="DWH::Functions::Dates#date_time_literal (method)">#date_time_literal</a></span>, <span class='object_link'><a href="../Functions/Dates.html#date_time_tz_format-instance_method" title="DWH::Functions::Dates#date_time_tz_format (method)">#date_time_tz_format</a></span>, <span class='object_link'><a href="../Functions/Dates.html#default_week_start_day-instance_method" title="DWH::Functions::Dates#default_week_start_day (method)">#default_week_start_day</a></span>, <span class='object_link'><a href="../Functions/Dates.html#truncate_date-instance_method" title="DWH::Functions::Dates#truncate_date (method)">#truncate_date</a></span>, <span class='object_link'><a href="../Functions/Dates.html#week_start_day-instance_method" title="DWH::Functions::Dates#week_start_day (method)">#week_start_day</a></span>, <span class='object_link'><a href="../Functions/Dates.html#week_starts_on_sunday%3F-instance_method" title="DWH::Functions::Dates#week_starts_on_sunday? (method)">#week_starts_on_sunday?</a></span></p>
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Capabilities.html" title="DWH::Capabilities (module)">Capabilities</a></span></h3>
|
544
|
+
<p class="inherited"><span class='object_link'><a href="../Capabilities.html#supports_array_functions%3F-instance_method" title="DWH::Capabilities#supports_array_functions? (method)">#supports_array_functions?</a></span>, <span class='object_link'><a href="../Capabilities.html#supports_common_table_expressions%3F-instance_method" title="DWH::Capabilities#supports_common_table_expressions? (method)">#supports_common_table_expressions?</a></span>, <span class='object_link'><a href="../Capabilities.html#supports_cross_join%3F-instance_method" title="DWH::Capabilities#supports_cross_join? (method)">#supports_cross_join?</a></span>, <span class='object_link'><a href="../Capabilities.html#supports_full_join%3F-instance_method" title="DWH::Capabilities#supports_full_join? (method)">#supports_full_join?</a></span>, <span class='object_link'><a href="../Capabilities.html#supports_sub_queries%3F-instance_method" title="DWH::Capabilities#supports_sub_queries? (method)">#supports_sub_queries?</a></span>, <span class='object_link'><a href="../Capabilities.html#supports_table_join%3F-instance_method" title="DWH::Capabilities#supports_table_join? (method)">#supports_table_join?</a></span>, <span class='object_link'><a href="../Capabilities.html#supports_temp_tables%3F-instance_method" title="DWH::Capabilities#supports_temp_tables? (method)">#supports_temp_tables?</a></span>, <span class='object_link'><a href="../Capabilities.html#supports_window_functions%3F-instance_method" title="DWH::Capabilities#supports_window_functions? (method)">#supports_window_functions?</a></span></p>
|
545
|
+
<div id="constructor_details" class="method_details_list">
|
546
|
+
<h2>Constructor Details</h2>
|
547
|
+
|
548
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Adapter.html#initialize-instance_method" title="DWH::Adapters::Adapter#initialize (method)">DWH::Adapters::Adapter</a></span></p>
|
549
|
+
|
550
|
+
</div>
|
551
|
+
|
552
|
+
|
553
|
+
<div id="instance_method_details" class="method_details_list">
|
554
|
+
<h2>Instance Method Details</h2>
|
555
|
+
|
556
|
+
|
557
|
+
<div class="method_details first">
|
558
|
+
<h3 class="signature first" id="connection-instance_method">
|
559
|
+
|
560
|
+
#<strong>connection</strong> ⇒ <tt>Object</tt>
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
</h3><table class="source_code">
|
567
|
+
<tr>
|
568
|
+
<td>
|
569
|
+
<pre class="lines">
|
570
|
+
|
571
|
+
|
572
|
+
32
|
573
|
+
33
|
574
|
+
34
|
575
|
+
35
|
576
|
+
36
|
577
|
+
37
|
578
|
+
38
|
579
|
+
39
|
580
|
+
40
|
581
|
+
41
|
582
|
+
42
|
583
|
+
43
|
584
|
+
44
|
585
|
+
45
|
586
|
+
46
|
587
|
+
47
|
588
|
+
48
|
589
|
+
49
|
590
|
+
50
|
591
|
+
51</pre>
|
592
|
+
</td>
|
593
|
+
<td>
|
594
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 32</span>
|
595
|
+
|
596
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
|
597
|
+
<span class='kw'>return</span> <span class='ivar'>@connection</span> <span class='kw'>if</span> <span class='ivar'>@connection</span>
|
598
|
+
|
599
|
+
<span class='id identifier rubyid_ssl_setup'>ssl_setup</span> <span class='op'>=</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:ssl</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='lbrace'>{</span> <span class='label'>verify:</span> <span class='kw'>false</span> <span class='rbrace'>}</span> <span class='op'>:</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:ssl</span><span class='rbracket'>]</span>
|
600
|
+
|
601
|
+
<span class='id identifier rubyid_properties'>properties</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
602
|
+
<span class='label'>server:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:host</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
603
|
+
<span class='label'>ssl:</span> <span class='id identifier rubyid_ssl_setup'>ssl_setup</span><span class='comma'>,</span>
|
604
|
+
<span class='label'>schema:</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:schema</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
605
|
+
<span class='label'>catalog:</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:catalog</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
606
|
+
<span class='label'>user:</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:username</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
607
|
+
<span class='label'>password:</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:password</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
608
|
+
<span class='label'>query_timeout:</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:query_timeout</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
609
|
+
<span class='label'>source:</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:client_name</span><span class='rbracket'>]</span>
|
610
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_extra_connection_params'>extra_connection_params</span><span class='rparen'>)</span>
|
611
|
+
|
612
|
+
<span class='ivar'>@connection</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Trino</span><span class='op'>::</span><span class='const'>Client</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_properties'>properties</span><span class='rparen'>)</span>
|
613
|
+
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
614
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ConfigError.html" title="DWH::ConfigError (class)">ConfigError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
615
|
+
<span class='kw'>end</span></pre>
|
616
|
+
</td>
|
617
|
+
</tr>
|
618
|
+
</table>
|
619
|
+
</div>
|
620
|
+
|
621
|
+
<div class="method_details ">
|
622
|
+
<h3 class="signature " id="execute-instance_method">
|
623
|
+
|
624
|
+
#<strong>execute</strong>(sql, format: :array, retries: 2) ⇒ <tt>Array<Array></tt>, ...
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
|
630
|
+
</h3><div class="docstring">
|
631
|
+
<div class="discussion">
|
632
|
+
<p>Execute sql on the target database.</p>
|
633
|
+
|
634
|
+
|
635
|
+
</div>
|
636
|
+
</div>
|
637
|
+
<div class="tags">
|
638
|
+
<p class="tag_title">Parameters:</p>
|
639
|
+
<ul class="param">
|
640
|
+
|
641
|
+
<li>
|
642
|
+
|
643
|
+
<span class='name'>sql</span>
|
644
|
+
|
645
|
+
|
646
|
+
<span class='type'>(<tt>String</tt>)</span>
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
—
|
651
|
+
<div class='inline'><p>actual sql</p>
|
652
|
+
</div>
|
653
|
+
|
654
|
+
</li>
|
655
|
+
|
656
|
+
<li>
|
657
|
+
|
658
|
+
<span class='name'>format</span>
|
659
|
+
|
660
|
+
|
661
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
662
|
+
|
663
|
+
|
664
|
+
<em class="default">(defaults to: <tt>:array</tt>)</em>
|
665
|
+
|
666
|
+
|
667
|
+
—
|
668
|
+
<div class='inline'><p>return format type
|
669
|
+
- array returns array of array
|
670
|
+
- object returns array of Hashes
|
671
|
+
- csv returns as csv
|
672
|
+
- native returns the native result from any clients used
|
673
|
+
- For example: Postgres using pg client will return PG::Result
|
674
|
+
- Http clients will returns the HTTP response object</p>
|
675
|
+
</div>
|
676
|
+
|
677
|
+
</li>
|
678
|
+
|
679
|
+
<li>
|
680
|
+
|
681
|
+
<span class='name'>retries</span>
|
682
|
+
|
683
|
+
|
684
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
685
|
+
|
686
|
+
|
687
|
+
<em class="default">(defaults to: <tt>2</tt>)</em>
|
688
|
+
|
689
|
+
|
690
|
+
—
|
691
|
+
<div class='inline'><p>number of retries in case of failure. Default is 0</p>
|
692
|
+
</div>
|
693
|
+
|
694
|
+
</li>
|
695
|
+
|
696
|
+
</ul>
|
697
|
+
|
698
|
+
<p class="tag_title">Returns:</p>
|
699
|
+
<ul class="return">
|
700
|
+
|
701
|
+
<li>
|
702
|
+
|
703
|
+
|
704
|
+
<span class='type'>(<tt>Array<Array></tt>, <tt>Hash</tt>, <tt>CSV</tt>, <tt>Native</tt>)</span>
|
705
|
+
|
706
|
+
|
707
|
+
|
708
|
+
</li>
|
709
|
+
|
710
|
+
</ul>
|
711
|
+
<p class="tag_title">Raises:</p>
|
712
|
+
<ul class="raise">
|
713
|
+
|
714
|
+
<li>
|
715
|
+
|
716
|
+
|
717
|
+
<span class='type'>(<tt><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></tt>, <tt><span class='object_link'><a href="../ExecutionError.html" title="DWH::ExecutionError (class)">ExecutionError</a></span></tt>)</span>
|
718
|
+
|
719
|
+
|
720
|
+
|
721
|
+
</li>
|
722
|
+
|
723
|
+
</ul>
|
724
|
+
|
725
|
+
</div><table class="source_code">
|
726
|
+
<tr>
|
727
|
+
<td>
|
728
|
+
<pre class="lines">
|
729
|
+
|
730
|
+
|
731
|
+
139
|
732
|
+
140
|
733
|
+
141
|
734
|
+
142
|
735
|
+
143
|
736
|
+
144
|
737
|
+
145
|
738
|
+
146
|
739
|
+
147
|
740
|
+
148
|
741
|
+
149
|
742
|
+
150
|
743
|
+
151
|
744
|
+
152
|
745
|
+
153
|
746
|
+
154
|
747
|
+
155
|
748
|
+
156
|
749
|
+
157
|
750
|
+
158
|
751
|
+
159
|
752
|
+
160
|
753
|
+
161
|
754
|
+
162
|
755
|
+
163
|
756
|
+
164</pre>
|
757
|
+
</td>
|
758
|
+
<td>
|
759
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 139</span>
|
760
|
+
|
761
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='comma'>,</span> <span class='label'>format:</span> <span class='symbol'>:array</span><span class='comma'>,</span> <span class='label'>retries:</span> <span class='int'>2</span><span class='rparen'>)</span>
|
762
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_with_debug'>with_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
763
|
+
<span class='id identifier rubyid_with_retry'>with_retry</span><span class='lparen'>(</span><span class='id identifier rubyid_retries'>retries</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
764
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>==</span> <span class='symbol'>:object</span>
|
765
|
+
<span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_run_with_names'>run_with_names</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span>
|
766
|
+
<span class='kw'>else</span>
|
767
|
+
<span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span>
|
768
|
+
<span class='kw'>end</span>
|
769
|
+
<span class='kw'>end</span>
|
770
|
+
<span class='kw'>end</span>
|
771
|
+
|
772
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span>
|
773
|
+
<span class='kw'>when</span> <span class='symbol'>:native</span>
|
774
|
+
<span class='id identifier rubyid_result'>result</span>
|
775
|
+
<span class='kw'>when</span> <span class='symbol'>:csv</span>
|
776
|
+
<span class='id identifier rubyid_result_to_csv'>result_to_csv</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
|
777
|
+
<span class='kw'>when</span> <span class='symbol'>:array</span>
|
778
|
+
<span class='id identifier rubyid_result'>result</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
779
|
+
<span class='kw'>when</span> <span class='symbol'>:object</span>
|
780
|
+
<span class='id identifier rubyid_result'>result</span>
|
781
|
+
<span class='kw'>else</span>
|
782
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../UnsupportedCapability.html" title="DWH::UnsupportedCapability (class)">UnsupportedCapability</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unknown format type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_content'>. Should be :native, :array, :object, or :csv</span><span class='tstring_end'>"</span></span>
|
783
|
+
<span class='kw'>end</span>
|
784
|
+
<span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>Trino</span><span class='op'>::</span><span class='const'>Client</span><span class='op'>::</span><span class='const'>TrinoQueryError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
785
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ExecutionError.html" title="DWH::ExecutionError (class)">ExecutionError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
786
|
+
<span class='kw'>end</span></pre>
|
787
|
+
</td>
|
788
|
+
</tr>
|
789
|
+
</table>
|
790
|
+
</div>
|
791
|
+
|
792
|
+
<div class="method_details ">
|
793
|
+
<h3 class="signature " id="execute_stream-instance_method">
|
794
|
+
|
795
|
+
#<strong>execute_stream</strong>(sql, io, stats: nil, retries: 1) ⇒ <tt>IO</tt>
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
</h3><div class="docstring">
|
802
|
+
<div class="discussion">
|
803
|
+
<p>Execute sql and stream responses back. Data is writtent out in CSV format
|
804
|
+
to the provided IO object.</p>
|
805
|
+
|
806
|
+
|
807
|
+
</div>
|
808
|
+
</div>
|
809
|
+
<div class="tags">
|
810
|
+
<p class="tag_title">Parameters:</p>
|
811
|
+
<ul class="param">
|
812
|
+
|
813
|
+
<li>
|
814
|
+
|
815
|
+
<span class='name'>sql</span>
|
816
|
+
|
817
|
+
|
818
|
+
<span class='type'>(<tt>String</tt>)</span>
|
819
|
+
|
820
|
+
|
821
|
+
|
822
|
+
—
|
823
|
+
<div class='inline'><p>actual sql</p>
|
824
|
+
</div>
|
825
|
+
|
826
|
+
</li>
|
827
|
+
|
828
|
+
<li>
|
829
|
+
|
830
|
+
<span class='name'>io</span>
|
831
|
+
|
832
|
+
|
833
|
+
<span class='type'>(<tt>IO</tt>)</span>
|
834
|
+
|
835
|
+
|
836
|
+
|
837
|
+
—
|
838
|
+
<div class='inline'><p>IO object to write records to</p>
|
839
|
+
</div>
|
840
|
+
|
841
|
+
</li>
|
842
|
+
|
843
|
+
<li>
|
844
|
+
|
845
|
+
<span class='name'>stats</span>
|
846
|
+
|
847
|
+
|
848
|
+
<span class='type'>(<tt><span class='object_link'><a href="../StreamingStats.html" title="DWH::StreamingStats (class)">StreamingStats</a></span></tt>)</span>
|
849
|
+
|
850
|
+
|
851
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
852
|
+
|
853
|
+
|
854
|
+
—
|
855
|
+
<div class='inline'><p>collect stats and preview data this is optional</p>
|
856
|
+
</div>
|
857
|
+
|
858
|
+
</li>
|
859
|
+
|
860
|
+
<li>
|
861
|
+
|
862
|
+
<span class='name'>retries</span>
|
863
|
+
|
864
|
+
|
865
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
866
|
+
|
867
|
+
|
868
|
+
<em class="default">(defaults to: <tt>1</tt>)</em>
|
869
|
+
|
870
|
+
|
871
|
+
—
|
872
|
+
<div class='inline'><p>number of retries in case of failure</p>
|
873
|
+
</div>
|
874
|
+
|
875
|
+
</li>
|
876
|
+
|
877
|
+
</ul>
|
878
|
+
|
879
|
+
<p class="tag_title">Returns:</p>
|
880
|
+
<ul class="return">
|
881
|
+
|
882
|
+
<li>
|
883
|
+
|
884
|
+
|
885
|
+
<span class='type'>(<tt>IO</tt>)</span>
|
886
|
+
|
887
|
+
|
888
|
+
|
889
|
+
</li>
|
890
|
+
|
891
|
+
</ul>
|
892
|
+
<p class="tag_title">Raises:</p>
|
893
|
+
<ul class="raise">
|
894
|
+
|
895
|
+
<li>
|
896
|
+
|
897
|
+
|
898
|
+
<span class='type'>(<tt><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></tt>, <tt><span class='object_link'><a href="../ExecutionError.html" title="DWH::ExecutionError (class)">ExecutionError</a></span></tt>)</span>
|
899
|
+
|
900
|
+
|
901
|
+
|
902
|
+
</li>
|
903
|
+
|
904
|
+
</ul>
|
905
|
+
|
906
|
+
</div><table class="source_code">
|
907
|
+
<tr>
|
908
|
+
<td>
|
909
|
+
<pre class="lines">
|
910
|
+
|
911
|
+
|
912
|
+
167
|
913
|
+
168
|
914
|
+
169
|
915
|
+
170
|
916
|
+
171
|
917
|
+
172
|
918
|
+
173
|
919
|
+
174
|
920
|
+
175
|
921
|
+
176
|
922
|
+
177
|
923
|
+
178
|
924
|
+
179
|
925
|
+
180
|
926
|
+
181
|
927
|
+
182</pre>
|
928
|
+
</td>
|
929
|
+
<td>
|
930
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 167</span>
|
931
|
+
|
932
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_execute_stream'>execute_stream</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='comma'>,</span> <span class='id identifier rubyid_io'>io</span><span class='comma'>,</span> <span class='label'>stats:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>retries:</span> <span class='int'>1</span><span class='rparen'>)</span>
|
933
|
+
<span class='id identifier rubyid_with_debug'>with_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
934
|
+
<span class='id identifier rubyid_with_retry'>with_retry</span><span class='lparen'>(</span><span class='id identifier rubyid_retries'>retries</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
935
|
+
<span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_result'>result</span><span class='op'>|</span>
|
936
|
+
<span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='const'>CSV</span><span class='period'>.</span><span class='id identifier rubyid_generate_line'>generate_line</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
937
|
+
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_each_row'>each_row</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
|
938
|
+
<span class='id identifier rubyid_stats'>stats</span> <span class='op'><<</span> <span class='id identifier rubyid_row'>row</span> <span class='kw'>if</span> <span class='id identifier rubyid_stats'>stats</span>
|
939
|
+
<span class='id identifier rubyid_io'>io</span> <span class='op'><<</span> <span class='const'>CSV</span><span class='period'>.</span><span class='id identifier rubyid_generate_line'>generate_line</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
940
|
+
<span class='kw'>end</span>
|
941
|
+
<span class='kw'>end</span>
|
942
|
+
<span class='kw'>end</span>
|
943
|
+
<span class='kw'>end</span>
|
944
|
+
|
945
|
+
<span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_rewind'>rewind</span>
|
946
|
+
<span class='id identifier rubyid_io'>io</span>
|
947
|
+
<span class='kw'>end</span></pre>
|
948
|
+
</td>
|
949
|
+
</tr>
|
950
|
+
</table>
|
951
|
+
</div>
|
952
|
+
|
953
|
+
<div class="method_details ">
|
954
|
+
<h3 class="signature " id="metadata-instance_method">
|
955
|
+
|
956
|
+
#<strong>metadata</strong>(table, **qualifiers) ⇒ <tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>
|
957
|
+
|
958
|
+
|
959
|
+
|
960
|
+
|
961
|
+
|
962
|
+
</h3><div class="docstring">
|
963
|
+
<div class="discussion">
|
964
|
+
<p>Get the schema structure of a given a given table_name.
|
965
|
+
Pass in optional catalog and schema info.</p>
|
966
|
+
|
967
|
+
<p>Example:
|
968
|
+
metadata(“public.big_table”)
|
969
|
+
metadata(“big_table”)
|
970
|
+
metadata(“big_table”,schema: “public”)</p>
|
971
|
+
|
972
|
+
|
973
|
+
</div>
|
974
|
+
</div>
|
975
|
+
<div class="tags">
|
976
|
+
<p class="tag_title">Parameters:</p>
|
977
|
+
<ul class="param">
|
978
|
+
|
979
|
+
<li>
|
980
|
+
|
981
|
+
<span class='name'>table</span>
|
982
|
+
|
983
|
+
|
984
|
+
<span class='type'>(<tt>String</tt>)</span>
|
985
|
+
|
986
|
+
|
987
|
+
|
988
|
+
—
|
989
|
+
<div class='inline'><ul>
|
990
|
+
<li>table name</li>
|
991
|
+
</ul>
|
992
|
+
</div>
|
993
|
+
|
994
|
+
</li>
|
995
|
+
|
996
|
+
<li>
|
997
|
+
|
998
|
+
<span class='name'>qualifiers</span>
|
999
|
+
|
1000
|
+
|
1001
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1002
|
+
|
1003
|
+
|
1004
|
+
|
1005
|
+
—
|
1006
|
+
<div class='inline'><p>a customizable set of options</p>
|
1007
|
+
</div>
|
1008
|
+
|
1009
|
+
</li>
|
1010
|
+
|
1011
|
+
</ul>
|
1012
|
+
|
1013
|
+
|
1014
|
+
|
1015
|
+
|
1016
|
+
|
1017
|
+
|
1018
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
1019
|
+
<ul class="option">
|
1020
|
+
|
1021
|
+
<li>
|
1022
|
+
<span class="name">:catalog</span>
|
1023
|
+
<span class="type">(<tt>String</tt>)</span>
|
1024
|
+
<span class="default">
|
1025
|
+
|
1026
|
+
</span>
|
1027
|
+
|
1028
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
1029
|
+
will be ignored if the adapter doesn’t support</p>
|
1030
|
+
</div>
|
1031
|
+
|
1032
|
+
</li>
|
1033
|
+
|
1034
|
+
<li>
|
1035
|
+
<span class="name">:schema</span>
|
1036
|
+
<span class="type">(<tt>String</tt>)</span>
|
1037
|
+
<span class="default">
|
1038
|
+
|
1039
|
+
</span>
|
1040
|
+
|
1041
|
+
— <div class='inline'><p>optional schema to scope to.
|
1042
|
+
will be ignored if the adapter doesn’t support</p>
|
1043
|
+
</div>
|
1044
|
+
|
1045
|
+
</li>
|
1046
|
+
|
1047
|
+
</ul>
|
1048
|
+
|
1049
|
+
|
1050
|
+
<p class="tag_title">Returns:</p>
|
1051
|
+
<ul class="return">
|
1052
|
+
|
1053
|
+
<li>
|
1054
|
+
|
1055
|
+
|
1056
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>)</span>
|
1057
|
+
|
1058
|
+
|
1059
|
+
|
1060
|
+
</li>
|
1061
|
+
|
1062
|
+
</ul>
|
1063
|
+
|
1064
|
+
</div><table class="source_code">
|
1065
|
+
<tr>
|
1066
|
+
<td>
|
1067
|
+
<pre class="lines">
|
1068
|
+
|
1069
|
+
|
1070
|
+
117
|
1071
|
+
118
|
1072
|
+
119
|
1073
|
+
120
|
1074
|
+
121
|
1075
|
+
122
|
1076
|
+
123
|
1077
|
+
124
|
1078
|
+
125
|
1079
|
+
126
|
1080
|
+
127
|
1081
|
+
128
|
1082
|
+
129
|
1083
|
+
130
|
1084
|
+
131
|
1085
|
+
132</pre>
|
1086
|
+
</td>
|
1087
|
+
<td>
|
1088
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 117</span>
|
1089
|
+
|
1090
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='rparen'>)</span>
|
1091
|
+
<span class='id identifier rubyid_db_table'>db_table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Table.html#initialize-instance_method" title="DWH::Table#initialize (method)">new</a></span></span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span>
|
1092
|
+
<span class='id identifier rubyid_sql'>sql</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SHOW COLUMNS FROM </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_fully_qualified_table_name'>fully_qualified_table_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1093
|
+
|
1094
|
+
<span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_cols'>cols</span> <span class='op'>=</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='comma'>,</span> <span class='label'>format:</span> <span class='symbol'>:native</span><span class='comma'>,</span> <span class='label'>retries:</span> <span class='int'>1</span><span class='rparen'>)</span>
|
1095
|
+
|
1096
|
+
<span class='id identifier rubyid_cols'>cols</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</span><span class='op'>|</span>
|
1097
|
+
<span class='id identifier rubyid_dt'>dt</span> <span class='op'>=</span> <span class='id identifier rubyid_col'>col</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>row(</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>struct</span><span class='tstring_end'>'</span></span> <span class='op'>:</span> <span class='id identifier rubyid_col'>col</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1098
|
+
<span class='id identifier rubyid_db_table'>db_table</span> <span class='op'><<</span> <span class='const'><span class='object_link'><a href="../Column.html" title="DWH::Column (class)">Column</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Column.html#initialize-instance_method" title="DWH::Column#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
1099
|
+
<span class='label'>name:</span> <span class='id identifier rubyid_col'>col</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1100
|
+
<span class='label'>data_type:</span> <span class='id identifier rubyid_dt'>dt</span>
|
1101
|
+
<span class='rparen'>)</span>
|
1102
|
+
<span class='kw'>end</span>
|
1103
|
+
|
1104
|
+
<span class='id identifier rubyid_db_table'>db_table</span>
|
1105
|
+
<span class='kw'>end</span></pre>
|
1106
|
+
</td>
|
1107
|
+
</tr>
|
1108
|
+
</table>
|
1109
|
+
</div>
|
1110
|
+
|
1111
|
+
<div class="method_details ">
|
1112
|
+
<h3 class="signature " id="schema?-instance_method">
|
1113
|
+
|
1114
|
+
#<strong>schema?</strong> ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
1115
|
+
|
1116
|
+
|
1117
|
+
|
1118
|
+
|
1119
|
+
|
1120
|
+
</h3><div class="docstring">
|
1121
|
+
<div class="discussion">
|
1122
|
+
|
1123
|
+
|
1124
|
+
|
1125
|
+
</div>
|
1126
|
+
</div>
|
1127
|
+
<div class="tags">
|
1128
|
+
|
1129
|
+
<p class="tag_title">Returns:</p>
|
1130
|
+
<ul class="return">
|
1131
|
+
|
1132
|
+
<li>
|
1133
|
+
|
1134
|
+
|
1135
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1136
|
+
|
1137
|
+
|
1138
|
+
|
1139
|
+
</li>
|
1140
|
+
|
1141
|
+
</ul>
|
1142
|
+
|
1143
|
+
</div><table class="source_code">
|
1144
|
+
<tr>
|
1145
|
+
<td>
|
1146
|
+
<pre class="lines">
|
1147
|
+
|
1148
|
+
|
1149
|
+
134
|
1150
|
+
135
|
1151
|
+
136</pre>
|
1152
|
+
</td>
|
1153
|
+
<td>
|
1154
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 134</span>
|
1155
|
+
|
1156
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema?'>schema?</span>
|
1157
|
+
<span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='symbol'>:schema</span><span class='rparen'>)</span>
|
1158
|
+
<span class='kw'>end</span></pre>
|
1159
|
+
</td>
|
1160
|
+
</tr>
|
1161
|
+
</table>
|
1162
|
+
</div>
|
1163
|
+
|
1164
|
+
<div class="method_details ">
|
1165
|
+
<h3 class="signature " id="stats-instance_method">
|
1166
|
+
|
1167
|
+
#<strong>stats</strong>(table, date_column: nil, **qualifiers) ⇒ <tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>
|
1168
|
+
|
1169
|
+
|
1170
|
+
|
1171
|
+
|
1172
|
+
|
1173
|
+
</h3><div class="docstring">
|
1174
|
+
<div class="discussion">
|
1175
|
+
<p>Returns basic stats of a given table. Will typically include row_count,
|
1176
|
+
date_start, and date_end.</p>
|
1177
|
+
|
1178
|
+
|
1179
|
+
</div>
|
1180
|
+
</div>
|
1181
|
+
<div class="tags">
|
1182
|
+
|
1183
|
+
<div class="examples">
|
1184
|
+
<h4 class="tag_title">Examples:</h4>
|
1185
|
+
|
1186
|
+
|
1187
|
+
<pre class="example code"><code><span class='id identifier rubyid_stats'>stats</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>public.big_table</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>date_column:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>fact_date</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1188
|
+
<span class='id identifier rubyid_stats'>stats</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>big_table</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1189
|
+
<span class='id identifier rubyid_stats'>stats</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>big_table</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='label'>schema:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>public</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span></code></pre>
|
1190
|
+
|
1191
|
+
</div>
|
1192
|
+
<p class="tag_title">Parameters:</p>
|
1193
|
+
<ul class="param">
|
1194
|
+
|
1195
|
+
<li>
|
1196
|
+
|
1197
|
+
<span class='name'>table</span>
|
1198
|
+
|
1199
|
+
|
1200
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1201
|
+
|
1202
|
+
|
1203
|
+
|
1204
|
+
—
|
1205
|
+
<div class='inline'><p>table name</p>
|
1206
|
+
</div>
|
1207
|
+
|
1208
|
+
</li>
|
1209
|
+
|
1210
|
+
<li>
|
1211
|
+
|
1212
|
+
<span class='name'>date_column</span>
|
1213
|
+
|
1214
|
+
|
1215
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1216
|
+
|
1217
|
+
|
1218
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1219
|
+
|
1220
|
+
|
1221
|
+
—
|
1222
|
+
<div class='inline'><p>optional date column to use to find range</p>
|
1223
|
+
</div>
|
1224
|
+
|
1225
|
+
</li>
|
1226
|
+
|
1227
|
+
<li>
|
1228
|
+
|
1229
|
+
<span class='name'>qualifiers</span>
|
1230
|
+
|
1231
|
+
|
1232
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1233
|
+
|
1234
|
+
|
1235
|
+
|
1236
|
+
—
|
1237
|
+
<div class='inline'><p>a customizable set of options</p>
|
1238
|
+
</div>
|
1239
|
+
|
1240
|
+
</li>
|
1241
|
+
|
1242
|
+
</ul>
|
1243
|
+
|
1244
|
+
|
1245
|
+
|
1246
|
+
|
1247
|
+
|
1248
|
+
|
1249
|
+
|
1250
|
+
|
1251
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
1252
|
+
<ul class="option">
|
1253
|
+
|
1254
|
+
<li>
|
1255
|
+
<span class="name">:catalog</span>
|
1256
|
+
<span class="type">(<tt>String</tt>)</span>
|
1257
|
+
<span class="default">
|
1258
|
+
|
1259
|
+
</span>
|
1260
|
+
|
1261
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
1262
|
+
will be ignored if the adapter doesn’t support</p>
|
1263
|
+
</div>
|
1264
|
+
|
1265
|
+
</li>
|
1266
|
+
|
1267
|
+
<li>
|
1268
|
+
<span class="name">:schema</span>
|
1269
|
+
<span class="type">(<tt>String</tt>)</span>
|
1270
|
+
<span class="default">
|
1271
|
+
|
1272
|
+
</span>
|
1273
|
+
|
1274
|
+
— <div class='inline'><p>optional schema to scope to.
|
1275
|
+
will be ignored if the adapter doesn’t support</p>
|
1276
|
+
</div>
|
1277
|
+
|
1278
|
+
</li>
|
1279
|
+
|
1280
|
+
</ul>
|
1281
|
+
|
1282
|
+
|
1283
|
+
<p class="tag_title">Returns:</p>
|
1284
|
+
<ul class="return">
|
1285
|
+
|
1286
|
+
<li>
|
1287
|
+
|
1288
|
+
|
1289
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>)</span>
|
1290
|
+
|
1291
|
+
|
1292
|
+
|
1293
|
+
</li>
|
1294
|
+
|
1295
|
+
</ul>
|
1296
|
+
<p class="tag_title">Raises:</p>
|
1297
|
+
<ul class="raise">
|
1298
|
+
|
1299
|
+
<li>
|
1300
|
+
|
1301
|
+
|
1302
|
+
<span class='type'>(<tt><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></tt>, <tt><span class='object_link'><a href="../ExecutionError.html" title="DWH::ExecutionError (class)">ExecutionError</a></span></tt>)</span>
|
1303
|
+
|
1304
|
+
|
1305
|
+
|
1306
|
+
</li>
|
1307
|
+
|
1308
|
+
</ul>
|
1309
|
+
|
1310
|
+
</div><table class="source_code">
|
1311
|
+
<tr>
|
1312
|
+
<td>
|
1313
|
+
<pre class="lines">
|
1314
|
+
|
1315
|
+
|
1316
|
+
97
|
1317
|
+
98
|
1318
|
+
99
|
1319
|
+
100
|
1320
|
+
101
|
1321
|
+
102
|
1322
|
+
103
|
1323
|
+
104
|
1324
|
+
105
|
1325
|
+
106
|
1326
|
+
107
|
1327
|
+
108
|
1328
|
+
109
|
1329
|
+
110
|
1330
|
+
111
|
1331
|
+
112
|
1332
|
+
113
|
1333
|
+
114</pre>
|
1334
|
+
</td>
|
1335
|
+
<td>
|
1336
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 97</span>
|
1337
|
+
|
1338
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_stats'>stats</span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='label'>date_column:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='rparen'>)</span>
|
1339
|
+
<span class='id identifier rubyid_db_table'>db_table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Table.html#initialize-instance_method" title="DWH::Table#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='rparen'>)</span>
|
1340
|
+
<span class='id identifier rubyid_sql'>sql</span> <span class='op'>=</span> <span class='heredoc_beg'><<-SQL</span>
|
1341
|
+
<span class='tstring_content'> SELECT count(*) ROW_COUNT
|
1342
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_date_column'>date_column</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>, min(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_date_column'>date_column</span><span class='embexpr_end'>}</span><span class='tstring_content'>) DATE_START</span><span class='tstring_end'>"</span></span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
1343
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_date_column'>date_column</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>, max(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_date_column'>date_column</span><span class='embexpr_end'>}</span><span class='tstring_content'>) DATE_END</span><span class='tstring_end'>"</span></span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
1344
|
+
FROM </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_fully_qualified_table_name'>fully_qualified_table_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
1345
|
+
</span><span class='heredoc_end'> SQL
|
1346
|
+
</span>
|
1347
|
+
<span class='id identifier rubyid_rows'>rows</span> <span class='op'>=</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='comma'>,</span> <span class='label'>retries:</span> <span class='int'>1</span><span class='rparen'>)</span>
|
1348
|
+
<span class='id identifier rubyid_row'>row</span> <span class='op'>=</span> <span class='id identifier rubyid_rows'>rows</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
1349
|
+
|
1350
|
+
<span class='const'><span class='object_link'><a href="../TableStats.html" title="DWH::TableStats (class)">TableStats</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../TableStats.html#initialize-instance_method" title="DWH::TableStats#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
1351
|
+
<span class='label'>date_start:</span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1352
|
+
<span class='label'>date_end:</span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1353
|
+
<span class='label'>row_count:</span> <span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
1354
|
+
<span class='rparen'>)</span>
|
1355
|
+
<span class='kw'>end</span></pre>
|
1356
|
+
</td>
|
1357
|
+
</tr>
|
1358
|
+
</table>
|
1359
|
+
</div>
|
1360
|
+
|
1361
|
+
<div class="method_details ">
|
1362
|
+
<h3 class="signature " id="stream-instance_method">
|
1363
|
+
|
1364
|
+
#<strong>stream</strong>(sql) {|chunk| ... } ⇒ <tt>Object</tt>
|
1365
|
+
|
1366
|
+
|
1367
|
+
|
1368
|
+
|
1369
|
+
|
1370
|
+
</h3><div class="docstring">
|
1371
|
+
<div class="discussion">
|
1372
|
+
<p>Executes the given sql and yields the streamed results
|
1373
|
+
to the given block.</p>
|
1374
|
+
|
1375
|
+
|
1376
|
+
</div>
|
1377
|
+
</div>
|
1378
|
+
<div class="tags">
|
1379
|
+
<p class="tag_title">Parameters:</p>
|
1380
|
+
<ul class="param">
|
1381
|
+
|
1382
|
+
<li>
|
1383
|
+
|
1384
|
+
<span class='name'>sql</span>
|
1385
|
+
|
1386
|
+
|
1387
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1388
|
+
|
1389
|
+
|
1390
|
+
|
1391
|
+
—
|
1392
|
+
<div class='inline'><p>actual sql</p>
|
1393
|
+
</div>
|
1394
|
+
|
1395
|
+
</li>
|
1396
|
+
|
1397
|
+
</ul>
|
1398
|
+
|
1399
|
+
<p class="tag_title">Yields:</p>
|
1400
|
+
<ul class="yield">
|
1401
|
+
|
1402
|
+
<li>
|
1403
|
+
|
1404
|
+
|
1405
|
+
<span class='type'>(<tt>chunk</tt>)</span>
|
1406
|
+
|
1407
|
+
|
1408
|
+
|
1409
|
+
—
|
1410
|
+
<div class='inline'><p>Yields a streamed chunk as it streams in. The chunk type
|
1411
|
+
might vary depending on the target db and settings</p>
|
1412
|
+
</div>
|
1413
|
+
|
1414
|
+
</li>
|
1415
|
+
|
1416
|
+
</ul>
|
1417
|
+
<p class="tag_title">Raises:</p>
|
1418
|
+
<ul class="raise">
|
1419
|
+
|
1420
|
+
<li>
|
1421
|
+
|
1422
|
+
|
1423
|
+
<span class='type'>(<tt><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></tt>, <tt><span class='object_link'><a href="../ExecutionError.html" title="DWH::ExecutionError (class)">ExecutionError</a></span></tt>)</span>
|
1424
|
+
|
1425
|
+
|
1426
|
+
|
1427
|
+
</li>
|
1428
|
+
|
1429
|
+
</ul>
|
1430
|
+
|
1431
|
+
</div><table class="source_code">
|
1432
|
+
<tr>
|
1433
|
+
<td>
|
1434
|
+
<pre class="lines">
|
1435
|
+
|
1436
|
+
|
1437
|
+
185
|
1438
|
+
186
|
1439
|
+
187
|
1440
|
+
188
|
1441
|
+
189
|
1442
|
+
190
|
1443
|
+
191</pre>
|
1444
|
+
</td>
|
1445
|
+
<td>
|
1446
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 185</span>
|
1447
|
+
|
1448
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_stream'>stream</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1449
|
+
<span class='id identifier rubyid_with_debug'>with_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1450
|
+
<span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_result'>result</span><span class='op'>|</span>
|
1451
|
+
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_each_row'>each_row</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1452
|
+
<span class='kw'>end</span>
|
1453
|
+
<span class='kw'>end</span>
|
1454
|
+
<span class='kw'>end</span></pre>
|
1455
|
+
</td>
|
1456
|
+
</tr>
|
1457
|
+
</table>
|
1458
|
+
</div>
|
1459
|
+
|
1460
|
+
<div class="method_details ">
|
1461
|
+
<h3 class="signature " id="table?-instance_method">
|
1462
|
+
|
1463
|
+
#<strong>table?</strong>(table, **qualifiers) ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
1464
|
+
|
1465
|
+
|
1466
|
+
|
1467
|
+
|
1468
|
+
|
1469
|
+
</h3><div class="docstring">
|
1470
|
+
<div class="discussion">
|
1471
|
+
<p>Check if table exists in remote db.</p>
|
1472
|
+
|
1473
|
+
|
1474
|
+
</div>
|
1475
|
+
</div>
|
1476
|
+
<div class="tags">
|
1477
|
+
<p class="tag_title">Parameters:</p>
|
1478
|
+
<ul class="param">
|
1479
|
+
|
1480
|
+
<li>
|
1481
|
+
|
1482
|
+
<span class='name'>qualifiers</span>
|
1483
|
+
|
1484
|
+
|
1485
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1486
|
+
|
1487
|
+
|
1488
|
+
|
1489
|
+
—
|
1490
|
+
<div class='inline'><p>a customizable set of options</p>
|
1491
|
+
</div>
|
1492
|
+
|
1493
|
+
</li>
|
1494
|
+
|
1495
|
+
</ul>
|
1496
|
+
|
1497
|
+
|
1498
|
+
|
1499
|
+
|
1500
|
+
|
1501
|
+
|
1502
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
1503
|
+
<ul class="option">
|
1504
|
+
|
1505
|
+
<li>
|
1506
|
+
<span class="name">:catalog</span>
|
1507
|
+
<span class="type">(<tt>String</tt>)</span>
|
1508
|
+
<span class="default">
|
1509
|
+
|
1510
|
+
</span>
|
1511
|
+
|
1512
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
1513
|
+
will be ignored if the adapter doesn’t support</p>
|
1514
|
+
</div>
|
1515
|
+
|
1516
|
+
</li>
|
1517
|
+
|
1518
|
+
<li>
|
1519
|
+
<span class="name">:schema</span>
|
1520
|
+
<span class="type">(<tt>String</tt>)</span>
|
1521
|
+
<span class="default">
|
1522
|
+
|
1523
|
+
</span>
|
1524
|
+
|
1525
|
+
— <div class='inline'><p>optional schema to scope to.
|
1526
|
+
will be ignored if the adapter doesn’t support</p>
|
1527
|
+
</div>
|
1528
|
+
|
1529
|
+
</li>
|
1530
|
+
|
1531
|
+
</ul>
|
1532
|
+
|
1533
|
+
|
1534
|
+
<p class="tag_title">Returns:</p>
|
1535
|
+
<ul class="return">
|
1536
|
+
|
1537
|
+
<li>
|
1538
|
+
|
1539
|
+
|
1540
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1541
|
+
|
1542
|
+
|
1543
|
+
|
1544
|
+
</li>
|
1545
|
+
|
1546
|
+
</ul>
|
1547
|
+
|
1548
|
+
</div><table class="source_code">
|
1549
|
+
<tr>
|
1550
|
+
<td>
|
1551
|
+
<pre class="lines">
|
1552
|
+
|
1553
|
+
|
1554
|
+
81
|
1555
|
+
82
|
1556
|
+
83
|
1557
|
+
84
|
1558
|
+
85
|
1559
|
+
86
|
1560
|
+
87
|
1561
|
+
88
|
1562
|
+
89
|
1563
|
+
90
|
1564
|
+
91
|
1565
|
+
92
|
1566
|
+
93
|
1567
|
+
94</pre>
|
1568
|
+
</td>
|
1569
|
+
<td>
|
1570
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 81</span>
|
1571
|
+
|
1572
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_table?'>table?</span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='rparen'>)</span>
|
1573
|
+
<span class='id identifier rubyid_db_table'>db_table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Table.html#initialize-instance_method" title="DWH::Table#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='rparen'>)</span>
|
1574
|
+
|
1575
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SHOW TABLES</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1576
|
+
|
1577
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_catalog_or_schema?'>catalog_or_schema?</span>
|
1578
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>FROM</span><span class='tstring_end'>'</span></span>
|
1579
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'><<</span> <span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_fully_qualified_schema_name'>fully_qualified_schema_name</span>
|
1580
|
+
<span class='kw'>end</span>
|
1581
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>LIKE '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_physical_name'>physical_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1582
|
+
|
1583
|
+
<span class='id identifier rubyid_rows'>rows</span> <span class='op'>=</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>retries:</span> <span class='int'>1</span><span class='rparen'>)</span>
|
1584
|
+
<span class='op'>!</span><span class='id identifier rubyid_rows'>rows</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1585
|
+
<span class='kw'>end</span></pre>
|
1586
|
+
</td>
|
1587
|
+
</tr>
|
1588
|
+
</table>
|
1589
|
+
</div>
|
1590
|
+
|
1591
|
+
<div class="method_details ">
|
1592
|
+
<h3 class="signature " id="tables-instance_method">
|
1593
|
+
|
1594
|
+
#<strong>tables</strong>(**qualifiers) ⇒ <tt>Array<String></tt>
|
1595
|
+
|
1596
|
+
|
1597
|
+
|
1598
|
+
|
1599
|
+
|
1600
|
+
</h3><div class="docstring">
|
1601
|
+
<div class="discussion">
|
1602
|
+
<p>Get all tables available in the
|
1603
|
+
target db. It will use the default catalog and schema
|
1604
|
+
config only specified here.</p>
|
1605
|
+
|
1606
|
+
|
1607
|
+
</div>
|
1608
|
+
</div>
|
1609
|
+
<div class="tags">
|
1610
|
+
<p class="tag_title">Parameters:</p>
|
1611
|
+
<ul class="param">
|
1612
|
+
|
1613
|
+
<li>
|
1614
|
+
|
1615
|
+
<span class='name'>qualifiers</span>
|
1616
|
+
|
1617
|
+
|
1618
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1619
|
+
|
1620
|
+
|
1621
|
+
|
1622
|
+
—
|
1623
|
+
<div class='inline'><p>a customizable set of options</p>
|
1624
|
+
</div>
|
1625
|
+
|
1626
|
+
</li>
|
1627
|
+
|
1628
|
+
</ul>
|
1629
|
+
|
1630
|
+
|
1631
|
+
|
1632
|
+
|
1633
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
1634
|
+
<ul class="option">
|
1635
|
+
|
1636
|
+
<li>
|
1637
|
+
<span class="name">:catalog</span>
|
1638
|
+
<span class="type">(<tt>String</tt>)</span>
|
1639
|
+
<span class="default">
|
1640
|
+
|
1641
|
+
</span>
|
1642
|
+
|
1643
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
1644
|
+
will be ignored if the adapter doesn’t support</p>
|
1645
|
+
</div>
|
1646
|
+
|
1647
|
+
</li>
|
1648
|
+
|
1649
|
+
<li>
|
1650
|
+
<span class="name">:schema</span>
|
1651
|
+
<span class="type">(<tt>String</tt>)</span>
|
1652
|
+
<span class="default">
|
1653
|
+
|
1654
|
+
</span>
|
1655
|
+
|
1656
|
+
— <div class='inline'><p>optional schema to scope to.
|
1657
|
+
will be ignored if the adapter doesn’t support</p>
|
1658
|
+
</div>
|
1659
|
+
|
1660
|
+
</li>
|
1661
|
+
|
1662
|
+
</ul>
|
1663
|
+
|
1664
|
+
|
1665
|
+
<p class="tag_title">Returns:</p>
|
1666
|
+
<ul class="return">
|
1667
|
+
|
1668
|
+
<li>
|
1669
|
+
|
1670
|
+
|
1671
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
1672
|
+
|
1673
|
+
|
1674
|
+
|
1675
|
+
</li>
|
1676
|
+
|
1677
|
+
</ul>
|
1678
|
+
|
1679
|
+
</div><table class="source_code">
|
1680
|
+
<tr>
|
1681
|
+
<td>
|
1682
|
+
<pre class="lines">
|
1683
|
+
|
1684
|
+
|
1685
|
+
64
|
1686
|
+
65
|
1687
|
+
66
|
1688
|
+
67
|
1689
|
+
68
|
1690
|
+
69
|
1691
|
+
70
|
1692
|
+
71
|
1693
|
+
72
|
1694
|
+
73
|
1695
|
+
74
|
1696
|
+
75
|
1697
|
+
76
|
1698
|
+
77
|
1699
|
+
78</pre>
|
1700
|
+
</td>
|
1701
|
+
<td>
|
1702
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 64</span>
|
1703
|
+
|
1704
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_tables'>tables</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='rparen'>)</span>
|
1705
|
+
<span class='id identifier rubyid_catalog'>catalog</span><span class='comma'>,</span> <span class='id identifier rubyid_schema'>schema</span> <span class='op'>=</span> <span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='period'>.</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='symbol'>:catalog</span><span class='comma'>,</span> <span class='symbol'>:schema</span><span class='rparen'>)</span>
|
1706
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SHOW TABLES</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1707
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>FROM</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_catalog'>catalog</span> <span class='op'>||</span> <span class='id identifier rubyid_schema'>schema</span>
|
1708
|
+
|
1709
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_catalog'>catalog</span> <span class='op'>&&</span> <span class='id identifier rubyid_schema'>schema</span>
|
1710
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_catalog'>catalog</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_schema'>schema</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1711
|
+
<span class='kw'>else</span>
|
1712
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'><<</span> <span class='id identifier rubyid_catalog'>catalog</span>
|
1713
|
+
<span class='id identifier rubyid_query'>query</span> <span class='op'><<</span> <span class='id identifier rubyid_schema'>schema</span>
|
1714
|
+
<span class='kw'>end</span>
|
1715
|
+
|
1716
|
+
<span class='id identifier rubyid_rows'>rows</span> <span class='op'>=</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>retries:</span> <span class='int'>1</span><span class='rparen'>)</span>
|
1717
|
+
<span class='id identifier rubyid_rows'>rows</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
|
1718
|
+
<span class='kw'>end</span></pre>
|
1719
|
+
</td>
|
1720
|
+
</tr>
|
1721
|
+
</table>
|
1722
|
+
</div>
|
1723
|
+
|
1724
|
+
<div class="method_details ">
|
1725
|
+
<h3 class="signature " id="test_connection-instance_method">
|
1726
|
+
|
1727
|
+
#<strong>test_connection</strong>(raise_exception: false) ⇒ <tt>Object</tt>
|
1728
|
+
|
1729
|
+
|
1730
|
+
|
1731
|
+
|
1732
|
+
|
1733
|
+
</h3><table class="source_code">
|
1734
|
+
<tr>
|
1735
|
+
<td>
|
1736
|
+
<pre class="lines">
|
1737
|
+
|
1738
|
+
|
1739
|
+
54
|
1740
|
+
55
|
1741
|
+
56
|
1742
|
+
57
|
1743
|
+
58
|
1744
|
+
59
|
1745
|
+
60
|
1746
|
+
61</pre>
|
1747
|
+
</td>
|
1748
|
+
<td>
|
1749
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 54</span>
|
1750
|
+
|
1751
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_test_connection'>test_connection</span><span class='lparen'>(</span><span class='label'>raise_exception:</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
1752
|
+
<span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>select 1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1753
|
+
<span class='kw'>true</span>
|
1754
|
+
<span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>Trino</span><span class='op'>::</span><span class='const'>Client</span><span class='op'>::</span><span class='const'>TrinoHttpError</span><span class='comma'>,</span> <span class='const'>Faraday</span><span class='op'>::</span><span class='const'>ConnectionFailed</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
1755
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='kw'>if</span> <span class='id identifier rubyid_raise_exception'>raise_exception</span>
|
1756
|
+
|
1757
|
+
<span class='kw'>false</span>
|
1758
|
+
<span class='kw'>end</span></pre>
|
1759
|
+
</td>
|
1760
|
+
</tr>
|
1761
|
+
</table>
|
1762
|
+
</div>
|
1763
|
+
|
1764
|
+
<div class="method_details ">
|
1765
|
+
<h3 class="signature " id="valid_config?-instance_method">
|
1766
|
+
|
1767
|
+
#<strong>valid_config?</strong> ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
1768
|
+
|
1769
|
+
|
1770
|
+
|
1771
|
+
|
1772
|
+
|
1773
|
+
</h3><div class="docstring">
|
1774
|
+
<div class="discussion">
|
1775
|
+
|
1776
|
+
|
1777
|
+
|
1778
|
+
</div>
|
1779
|
+
</div>
|
1780
|
+
<div class="tags">
|
1781
|
+
|
1782
|
+
<p class="tag_title">Returns:</p>
|
1783
|
+
<ul class="return">
|
1784
|
+
|
1785
|
+
<li>
|
1786
|
+
|
1787
|
+
|
1788
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1789
|
+
|
1790
|
+
|
1791
|
+
|
1792
|
+
</li>
|
1793
|
+
|
1794
|
+
</ul>
|
1795
|
+
|
1796
|
+
</div><table class="source_code">
|
1797
|
+
<tr>
|
1798
|
+
<td>
|
1799
|
+
<pre class="lines">
|
1800
|
+
|
1801
|
+
|
1802
|
+
193
|
1803
|
+
194
|
1804
|
+
195
|
1805
|
+
196
|
1806
|
+
197
|
1807
|
+
198</pre>
|
1808
|
+
</td>
|
1809
|
+
<td>
|
1810
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/trino.rb', line 193</span>
|
1811
|
+
|
1812
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_valid_config?'>valid_config?</span>
|
1813
|
+
<span class='kw'>super</span>
|
1814
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>trino-client</span><span class='tstring_end'>'</span></span>
|
1815
|
+
<span class='kw'>rescue</span> <span class='const'>LoadError</span>
|
1816
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ConfigError.html" title="DWH::ConfigError (class)">ConfigError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Required 'trino-client' gem missing. Please add it to your Gemfile.</span><span class='tstring_end'>"</span></span>
|
1817
|
+
<span class='kw'>end</span></pre>
|
1818
|
+
</td>
|
1819
|
+
</tr>
|
1820
|
+
</table>
|
1821
|
+
</div>
|
1822
|
+
|
1823
|
+
</div>
|
1824
|
+
|
1825
|
+
</div>
|
1826
|
+
|
1827
|
+
<div id="footer">
|
1828
|
+
Generated on Fri Aug 22 08:31:22 2025 by
|
1829
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1830
|
+
0.9.37 (ruby-3.4.4).
|
1831
|
+
</div>
|
1832
|
+
|
1833
|
+
</div>
|
1834
|
+
</body>
|
1835
|
+
</html>
|