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,3053 @@
|
|
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::Adapter
|
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::Adapter";
|
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 (A)</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">Adapter</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::Adapter
|
63
|
+
<span class="abstract note title">Abstract</span>
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">DWH::Adapters::Adapter</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
<dl>
|
89
|
+
<dt>Extended by:</dt>
|
90
|
+
<dd><span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></dd>
|
91
|
+
</dl>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Includes:</dt>
|
97
|
+
<dd><span class='object_link'><a href="../Behaviors.html" title="DWH::Behaviors (module)">Behaviors</a></span>, <span class='object_link'><a href="../Capabilities.html" title="DWH::Capabilities (module)">Capabilities</a></span>, <span class='object_link'><a href="../Functions.html" title="DWH::Functions (module)">Functions</a></span>, <span class='object_link'><a href="../Logger.html" title="DWH::Logger (module)">Logger</a></span></dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<dl>
|
106
|
+
<dt>Defined in:</dt>
|
107
|
+
<dd>lib/dwh/adapters.rb</dd>
|
108
|
+
</dl>
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<h2>Overview</h2><div class="docstring">
|
113
|
+
<div class="discussion">
|
114
|
+
<div class="note abstract">
|
115
|
+
<strong>This class is abstract.</strong>
|
116
|
+
<div class='inline'><p>Adapters base class. All adapters should inherit from this class
|
117
|
+
and implement these core required methods:</p>
|
118
|
+
|
119
|
+
<ul>
|
120
|
+
<li><span class='object_link'><a href="#stats-instance_method" title="DWH::Adapters::Adapter#stats (method)">#stats</a></span> - get table statistics</li>
|
121
|
+
<li><span class='object_link'><a href="#tables-instance_method" title="DWH::Adapters::Adapter#tables (method)">#tables</a></span> - list tables</li>
|
122
|
+
<li><span class='object_link'><a href="#metadata-instance_method" title="DWH::Adapters::Adapter#metadata (method)">#metadata</a></span> - get metadata for a specific table</li>
|
123
|
+
<li><span class='object_link'><a href="#execute-instance_method" title="DWH::Adapters::Adapter#execute (method)">#execute</a></span> - run query and return result</li>
|
124
|
+
<li><span class='object_link'><a href="#execute_stream-instance_method" title="DWH::Adapters::Adapter#execute_stream (method)">#execute_stream</a></span> - run query and stream results to provided IO</li>
|
125
|
+
<li><span class='object_link'><a href="#stream-instance_method" title="DWH::Adapters::Adapter#stream (method)">#stream</a></span> - run query and yeild streaming results</li>
|
126
|
+
</ul>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
<p>Adapter implementations can declare configuration options,
|
130
|
+
defaults, and whether it is required. This is a class
|
131
|
+
level method. They will be validated and a <span class='object_link'><a href="../ConfigError.html" title="DWH::ConfigError (class)">ConfigError</a></span> will be raised
|
132
|
+
if there is an issue. Methods not implemented will raise NotImplementedError</p>
|
133
|
+
|
134
|
+
<p>Additionally, if certain setting need to be overridden you can add a settings
|
135
|
+
file in a relative directory like so: <em>settings/my_adapter.yml</em>. Or, you can specify
|
136
|
+
an exact settings file location at the class level:</p>
|
137
|
+
|
138
|
+
<p>class MyAdapter < DWH::Adapters::Adapter
|
139
|
+
settings_file_path “my_dir/my_settings.yml”
|
140
|
+
end</p>
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
<div class="tags">
|
146
|
+
|
147
|
+
<div class="examples">
|
148
|
+
<h4 class="tag_title">Examples:</h4>
|
149
|
+
|
150
|
+
|
151
|
+
<pre class="example code"><code><span class='kw'>class</span> <span class='const'>MyAdapter</span> <span class='op'><</span> <span class='const'><span class='object_link'><a href="../../DWH.html" title="DWH (module)">DWH</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Adapters.html" title="DWH::Adapters (module)">Adapters</a></span></span><span class='op'>::</span><span class='const'>Adapter</span>
|
152
|
+
<span class='id identifier rubyid_config'>config</span> <span class='symbol'>:username</span><span class='comma'>,</span> <span class='const'>String</span><span class='comma'>,</span> <span class='label'>required:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>login id of the current user</span><span class='tstring_end'>"</span></span>
|
153
|
+
<span class='id identifier rubyid_config'>config</span> <span class='symbol'>:port</span><span class='comma'>,</span> <span class='const'>Integer</span><span class='comma'>,</span> <span class='label'>required:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='int'>5432</span>
|
154
|
+
<span class='kw'>end</span></code></pre>
|
155
|
+
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
</div><div id="subclasses">
|
160
|
+
<h2>Direct Known Subclasses</h2>
|
161
|
+
<p class="children"><span class='object_link'><a href="Athena.html" title="DWH::Adapters::Athena (class)">Athena</a></span>, <span class='object_link'><a href="Druid.html" title="DWH::Adapters::Druid (class)">Druid</a></span>, <span class='object_link'><a href="DuckDb.html" title="DWH::Adapters::DuckDb (class)">DuckDb</a></span>, <span class='object_link'><a href="MySql.html" title="DWH::Adapters::MySql (class)">MySql</a></span>, <span class='object_link'><a href="Postgres.html" title="DWH::Adapters::Postgres (class)">Postgres</a></span>, <span class='object_link'><a href="Snowflake.html" title="DWH::Adapters::Snowflake (class)">Snowflake</a></span>, <span class='object_link'><a href="SqlServer.html" title="DWH::Adapters::SqlServer (class)">SqlServer</a></span>, <span class='object_link'><a href="Trino.html" title="DWH::Adapters::Trino (class)">Trino</a></span></p>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<h2>Constant Summary</h2>
|
167
|
+
|
168
|
+
<h3 class="inherited">Constants included
|
169
|
+
from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
170
|
+
<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>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
<h3 class="inherited">Constants included
|
175
|
+
from <span class='object_link'><a href="../Functions/Dates.html" title="DWH::Functions::Dates (module)">Functions::Dates</a></span></h3>
|
176
|
+
<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>
|
177
|
+
|
178
|
+
|
179
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
180
|
+
<ul class="summary">
|
181
|
+
|
182
|
+
<li class="public ">
|
183
|
+
<span class="summary_signature">
|
184
|
+
|
185
|
+
<a href="#config-instance_method" title="#config (instance method)">#<strong>config</strong> ⇒ Hash </a>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</span>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<span class="note title readonly">readonly</span>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
<span class="summary_desc"><div class='inline'><p>Instance level configurations.</p>
|
205
|
+
</div></span>
|
206
|
+
|
207
|
+
</li>
|
208
|
+
|
209
|
+
|
210
|
+
<li class="public ">
|
211
|
+
<span class="summary_signature">
|
212
|
+
|
213
|
+
<a href="#settings-instance_method" title="#settings (instance method)">#<strong>settings</strong> ⇒ Hash </a>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
</span>
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="note title readonly">readonly</span>
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
<span class="summary_desc"><div class='inline'><p>This is the actual runtime settings used by the adapter once initialized.</p>
|
233
|
+
</div></span>
|
234
|
+
|
235
|
+
</li>
|
236
|
+
|
237
|
+
|
238
|
+
</ul>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
<h3 class="inherited">Attributes included from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
245
|
+
<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>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<h2>
|
250
|
+
Class Method Summary
|
251
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
252
|
+
</h2>
|
253
|
+
|
254
|
+
<ul class="summary">
|
255
|
+
|
256
|
+
<li class="public ">
|
257
|
+
<span class="summary_signature">
|
258
|
+
|
259
|
+
<a href="#config-class_method" title="config (class method)">.<strong>config</strong>(name, type, options = {}) ⇒ Hash </a>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
</span>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
<span class="summary_desc"><div class='inline'><p>Define the configurations required for the adapter to connect and query target database.</p>
|
274
|
+
</div></span>
|
275
|
+
|
276
|
+
</li>
|
277
|
+
|
278
|
+
|
279
|
+
<li class="public ">
|
280
|
+
<span class="summary_signature">
|
281
|
+
|
282
|
+
<a href="#configuration-class_method" title="configuration (class method)">.<strong>configuration</strong> ⇒ Hash </a>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
</span>
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
<span class="summary_desc"><div class='inline'><p>Get the adapter class level configuration settings.</p>
|
297
|
+
</div></span>
|
298
|
+
|
299
|
+
</li>
|
300
|
+
|
301
|
+
|
302
|
+
</ul>
|
303
|
+
|
304
|
+
<h2>
|
305
|
+
Instance Method Summary
|
306
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
307
|
+
</h2>
|
308
|
+
|
309
|
+
<ul class="summary">
|
310
|
+
|
311
|
+
<li class="public ">
|
312
|
+
<span class="summary_signature">
|
313
|
+
|
314
|
+
<a href="#adapter_name-instance_method" title="#adapter_name (instance method)">#<strong>adapter_name</strong> ⇒ String </a>
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
</span>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
<span class="summary_desc"><div class='inline'><p>Adapter name from the class name.</p>
|
329
|
+
</div></span>
|
330
|
+
|
331
|
+
</li>
|
332
|
+
|
333
|
+
|
334
|
+
<li class="public ">
|
335
|
+
<span class="summary_signature">
|
336
|
+
|
337
|
+
<a href="#alter_settings-instance_method" title="#alter_settings (instance method)">#<strong>alter_settings</strong>(changes = {}) ⇒ Hash </a>
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
</span>
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<span class="summary_desc"><div class='inline'><p>Allows an already instantiated adapter to change its current settings.</p>
|
352
|
+
</div></span>
|
353
|
+
|
354
|
+
</li>
|
355
|
+
|
356
|
+
|
357
|
+
<li class="public ">
|
358
|
+
<span class="summary_signature">
|
359
|
+
|
360
|
+
<a href="#close-instance_method" title="#close (instance method)">#<strong>close</strong> ⇒ Object </a>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
</span>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
<span class="summary_desc"><div class='inline'><p>Close the connection if it was created.</p>
|
375
|
+
</div></span>
|
376
|
+
|
377
|
+
</li>
|
378
|
+
|
379
|
+
|
380
|
+
<li class="public ">
|
381
|
+
<span class="summary_signature">
|
382
|
+
|
383
|
+
<a href="#connect!-instance_method" title="#connect! (instance method)">#<strong>connect!</strong> ⇒ Boolean </a>
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
</span>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
<span class="summary_desc"><div class='inline'><p>Test connection and raise exception if connection fails.</p>
|
398
|
+
</div></span>
|
399
|
+
|
400
|
+
</li>
|
401
|
+
|
402
|
+
|
403
|
+
<li class="public ">
|
404
|
+
<span class="summary_signature">
|
405
|
+
|
406
|
+
<a href="#connect%3F-instance_method" title="#connect? (instance method)">#<strong>connect?</strong> ⇒ Boolean </a>
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
</span>
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
<span class="summary_desc"><div class='inline'><p>Tests whether the dtabase can be connected.</p>
|
421
|
+
</div></span>
|
422
|
+
|
423
|
+
</li>
|
424
|
+
|
425
|
+
|
426
|
+
<li class="public ">
|
427
|
+
<span class="summary_signature">
|
428
|
+
|
429
|
+
<a href="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong> ⇒ Object </a>
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
</span>
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
<span class="summary_desc"><div class='inline'><p>Creates a connection to the target database and returns the connection object or self.</p>
|
444
|
+
</div></span>
|
445
|
+
|
446
|
+
</li>
|
447
|
+
|
448
|
+
|
449
|
+
<li class="public ">
|
450
|
+
<span class="summary_signature">
|
451
|
+
|
452
|
+
<a href="#execute-instance_method" title="#execute (instance method)">#<strong>execute</strong>(sql, format: :array, retries: 0) ⇒ Array<Array>, ... </a>
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
</span>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
<span class="summary_desc"><div class='inline'><p>Execute sql on the target database.</p>
|
467
|
+
</div></span>
|
468
|
+
|
469
|
+
</li>
|
470
|
+
|
471
|
+
|
472
|
+
<li class="public ">
|
473
|
+
<span class="summary_signature">
|
474
|
+
|
475
|
+
<a href="#execute_stream-instance_method" title="#execute_stream (instance method)">#<strong>execute_stream</strong>(sql, io, stats: nil, retries: 0) ⇒ IO </a>
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
</span>
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
<span class="summary_desc"><div class='inline'><p>Execute sql and stream responses back.</p>
|
490
|
+
</div></span>
|
491
|
+
|
492
|
+
</li>
|
493
|
+
|
494
|
+
|
495
|
+
<li class="public ">
|
496
|
+
<span class="summary_signature">
|
497
|
+
|
498
|
+
<a href="#extra_connection_params-instance_method" title="#extra_connection_params (instance method)">#<strong>extra_connection_params</strong> ⇒ Hash </a>
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
</span>
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
<span class="summary_desc"><div class='inline'><p>If any extra connection params were passed in the config object, this will return it.</p>
|
513
|
+
</div></span>
|
514
|
+
|
515
|
+
</li>
|
516
|
+
|
517
|
+
|
518
|
+
<li class="public ">
|
519
|
+
<span class="summary_signature">
|
520
|
+
|
521
|
+
<a href="#extra_query_params-instance_method" title="#extra_query_params (instance method)">#<strong>extra_query_params</strong> ⇒ Hash </a>
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
</span>
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
<span class="summary_desc"><div class='inline'><p>If the adapter supports it, will pass on extra query params from the config to the executor.</p>
|
536
|
+
</div></span>
|
537
|
+
|
538
|
+
</li>
|
539
|
+
|
540
|
+
|
541
|
+
<li class="public ">
|
542
|
+
<span class="summary_signature">
|
543
|
+
|
544
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(config) ⇒ Adapter </a>
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
</span>
|
549
|
+
|
550
|
+
|
551
|
+
<span class="note title constructor">constructor</span>
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of Adapter.</p>
|
561
|
+
</div></span>
|
562
|
+
|
563
|
+
</li>
|
564
|
+
|
565
|
+
|
566
|
+
<li class="public ">
|
567
|
+
<span class="summary_signature">
|
568
|
+
|
569
|
+
<a href="#metadata-instance_method" title="#metadata (instance method)">#<strong>metadata</strong>(table, **qualifiers) ⇒ DWH::Table </a>
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
</span>
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
<span class="summary_desc"><div class='inline'><p>Get the schema structure of a given a given table_name.</p>
|
584
|
+
</div></span>
|
585
|
+
|
586
|
+
</li>
|
587
|
+
|
588
|
+
|
589
|
+
<li class="public ">
|
590
|
+
<span class="summary_signature">
|
591
|
+
|
592
|
+
<a href="#reset_settings-instance_method" title="#reset_settings (instance method)">#<strong>reset_settings</strong> ⇒ Hash </a>
|
593
|
+
|
594
|
+
|
595
|
+
|
596
|
+
</span>
|
597
|
+
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
<span class="summary_desc"><div class='inline'><p>This returns settings back to its original state prior to running alter_settings.</p>
|
607
|
+
</div></span>
|
608
|
+
|
609
|
+
</li>
|
610
|
+
|
611
|
+
|
612
|
+
<li class="public ">
|
613
|
+
<span class="summary_signature">
|
614
|
+
|
615
|
+
<a href="#stats-instance_method" title="#stats (instance method)">#<strong>stats</strong>(table, date_column: nil, **qualifiers) ⇒ DWH::Table </a>
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
</span>
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
<span class="summary_desc"><div class='inline'><p>Returns basic stats of a given table.</p>
|
630
|
+
</div></span>
|
631
|
+
|
632
|
+
</li>
|
633
|
+
|
634
|
+
|
635
|
+
<li class="public ">
|
636
|
+
<span class="summary_signature">
|
637
|
+
|
638
|
+
<a href="#stream-instance_method" title="#stream (instance method)">#<strong>stream</strong>(sql) {|chunk| ... } ⇒ Object </a>
|
639
|
+
|
640
|
+
|
641
|
+
|
642
|
+
</span>
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
|
651
|
+
|
652
|
+
<span class="summary_desc"><div class='inline'><p>Executes the given sql and yields the streamed results to the given block.</p>
|
653
|
+
</div></span>
|
654
|
+
|
655
|
+
</li>
|
656
|
+
|
657
|
+
|
658
|
+
<li class="public ">
|
659
|
+
<span class="summary_signature">
|
660
|
+
|
661
|
+
<a href="#table%3F-instance_method" title="#table? (instance method)">#<strong>table?</strong>(table, **qualifiers) ⇒ Boolean </a>
|
662
|
+
|
663
|
+
|
664
|
+
|
665
|
+
</span>
|
666
|
+
|
667
|
+
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
<span class="summary_desc"><div class='inline'><p>Check if table exists in remote db.</p>
|
676
|
+
</div></span>
|
677
|
+
|
678
|
+
</li>
|
679
|
+
|
680
|
+
|
681
|
+
<li class="public ">
|
682
|
+
<span class="summary_signature">
|
683
|
+
|
684
|
+
<a href="#tables-instance_method" title="#tables (instance method)">#<strong>tables</strong>(**qualifiers) ⇒ Array<String> </a>
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
</span>
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
<span class="summary_desc"><div class='inline'><p>Get all tables available in the target db.</p>
|
699
|
+
</div></span>
|
700
|
+
|
701
|
+
</li>
|
702
|
+
|
703
|
+
|
704
|
+
<li class="public ">
|
705
|
+
<span class="summary_signature">
|
706
|
+
|
707
|
+
<a href="#test_connection-instance_method" title="#test_connection (instance method)">#<strong>test_connection</strong>(raise_exception: false) ⇒ Boolean </a>
|
708
|
+
|
709
|
+
|
710
|
+
|
711
|
+
</span>
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
|
721
|
+
<span class="summary_desc"><div class='inline'><p>Tests the connection to the target database and returns true if successful, or raise Exception or false connection object or self.</p>
|
722
|
+
</div></span>
|
723
|
+
|
724
|
+
</li>
|
725
|
+
|
726
|
+
|
727
|
+
<li class="public ">
|
728
|
+
<span class="summary_signature">
|
729
|
+
|
730
|
+
<a href="#token_expired%3F-instance_method" title="#token_expired? (instance method)">#<strong>token_expired?</strong> ⇒ Boolean </a>
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
</span>
|
735
|
+
|
736
|
+
|
737
|
+
|
738
|
+
|
739
|
+
|
740
|
+
|
741
|
+
|
742
|
+
|
743
|
+
|
744
|
+
<span class="summary_desc"><div class='inline'><p>For adapters that uses access tokens via jwt or oauth this will return wether a tokens is expired.</p>
|
745
|
+
</div></span>
|
746
|
+
|
747
|
+
</li>
|
748
|
+
|
749
|
+
|
750
|
+
<li class="public ">
|
751
|
+
<span class="summary_signature">
|
752
|
+
|
753
|
+
<a href="#with_debug-instance_method" title="#with_debug (instance method)">#<strong>with_debug</strong>(sql, &block) ⇒ Object </a>
|
754
|
+
|
755
|
+
|
756
|
+
|
757
|
+
</span>
|
758
|
+
|
759
|
+
|
760
|
+
|
761
|
+
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
<span class="summary_desc"><div class='inline'><p>Wraps an SQL execution with debug logging.</p>
|
768
|
+
</div></span>
|
769
|
+
|
770
|
+
</li>
|
771
|
+
|
772
|
+
|
773
|
+
<li class="public ">
|
774
|
+
<span class="summary_signature">
|
775
|
+
|
776
|
+
<a href="#with_retry-instance_method" title="#with_retry (instance method)">#<strong>with_retry</strong>(max_attempts = 2, &block) ⇒ Object </a>
|
777
|
+
|
778
|
+
|
779
|
+
|
780
|
+
</span>
|
781
|
+
|
782
|
+
|
783
|
+
|
784
|
+
|
785
|
+
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
|
790
|
+
<span class="summary_desc"><div class='inline'><p>Will call the block with retries given by the max attempts param.</p>
|
791
|
+
</div></span>
|
792
|
+
|
793
|
+
</li>
|
794
|
+
|
795
|
+
|
796
|
+
</ul>
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
|
802
|
+
|
803
|
+
|
804
|
+
|
805
|
+
|
806
|
+
|
807
|
+
|
808
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
809
|
+
<p class="inherited"><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>
|
810
|
+
|
811
|
+
|
812
|
+
|
813
|
+
|
814
|
+
|
815
|
+
|
816
|
+
|
817
|
+
|
818
|
+
|
819
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Logger.html" title="DWH::Logger (module)">Logger</a></span></h3>
|
820
|
+
<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>
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
|
828
|
+
|
829
|
+
|
830
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Behaviors.html" title="DWH::Behaviors (module)">Behaviors</a></span></h3>
|
831
|
+
<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>
|
832
|
+
|
833
|
+
|
834
|
+
|
835
|
+
|
836
|
+
|
837
|
+
|
838
|
+
|
839
|
+
|
840
|
+
|
841
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Functions.html" title="DWH::Functions (module)">Functions</a></span></h3>
|
842
|
+
<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>
|
843
|
+
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
|
848
|
+
|
849
|
+
|
850
|
+
|
851
|
+
|
852
|
+
<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>
|
853
|
+
<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>
|
854
|
+
|
855
|
+
|
856
|
+
|
857
|
+
|
858
|
+
|
859
|
+
|
860
|
+
|
861
|
+
|
862
|
+
|
863
|
+
<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>
|
864
|
+
<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>
|
865
|
+
|
866
|
+
|
867
|
+
|
868
|
+
|
869
|
+
|
870
|
+
|
871
|
+
|
872
|
+
|
873
|
+
|
874
|
+
<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>
|
875
|
+
<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>
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
|
880
|
+
|
881
|
+
|
882
|
+
|
883
|
+
|
884
|
+
|
885
|
+
<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>
|
886
|
+
<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>
|
887
|
+
|
888
|
+
|
889
|
+
|
890
|
+
|
891
|
+
|
892
|
+
|
893
|
+
|
894
|
+
|
895
|
+
|
896
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Capabilities.html" title="DWH::Capabilities (module)">Capabilities</a></span></h3>
|
897
|
+
<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>
|
898
|
+
<div id="constructor_details" class="method_details_list">
|
899
|
+
<h2>Constructor Details</h2>
|
900
|
+
|
901
|
+
<div class="method_details first">
|
902
|
+
<h3 class="signature first" id="initialize-instance_method">
|
903
|
+
|
904
|
+
#<strong>initialize</strong>(config) ⇒ <tt><span class='object_link'><a href="" title="DWH::Adapters::Adapter (class)">Adapter</a></span></tt>
|
905
|
+
|
906
|
+
|
907
|
+
|
908
|
+
|
909
|
+
|
910
|
+
</h3><div class="docstring">
|
911
|
+
<div class="discussion">
|
912
|
+
<p>Returns a new instance of Adapter.</p>
|
913
|
+
|
914
|
+
|
915
|
+
</div>
|
916
|
+
</div>
|
917
|
+
<div class="tags">
|
918
|
+
|
919
|
+
|
920
|
+
</div><table class="source_code">
|
921
|
+
<tr>
|
922
|
+
<td>
|
923
|
+
<pre class="lines">
|
924
|
+
|
925
|
+
|
926
|
+
82
|
927
|
+
83
|
928
|
+
84
|
929
|
+
85
|
930
|
+
86
|
931
|
+
87
|
932
|
+
88
|
933
|
+
89
|
934
|
+
90
|
935
|
+
91
|
936
|
+
92</pre>
|
937
|
+
</td>
|
938
|
+
<td>
|
939
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 82</span>
|
940
|
+
|
941
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
|
942
|
+
<span class='ivar'>@config</span> <span class='op'>=</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span>
|
943
|
+
<span class='comment'># Per instance customization of general settings
|
944
|
+
</span> <span class='comment'># So you can have multiple connections to Trino
|
945
|
+
</span> <span class='comment'># but exhibit diff behavior
|
946
|
+
</span> <span class='ivar'>@settings</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_adapter_settings'>adapter_settings</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span>
|
947
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:settings</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span>
|
948
|
+
<span class='rparen'>)</span>
|
949
|
+
|
950
|
+
<span class='id identifier rubyid_valid_config?'>valid_config?</span>
|
951
|
+
<span class='kw'>end</span></pre>
|
952
|
+
</td>
|
953
|
+
</tr>
|
954
|
+
</table>
|
955
|
+
</div>
|
956
|
+
|
957
|
+
</div>
|
958
|
+
|
959
|
+
<div id="instance_attr_details" class="attr_details">
|
960
|
+
<h2>Instance Attribute Details</h2>
|
961
|
+
|
962
|
+
|
963
|
+
<span id=""></span>
|
964
|
+
<div class="method_details first">
|
965
|
+
<h3 class="signature first" id="config-instance_method">
|
966
|
+
|
967
|
+
#<strong>config</strong> ⇒ <tt>Hash</tt> <span class="extras">(readonly)</span>
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
|
972
|
+
|
973
|
+
</h3><div class="docstring">
|
974
|
+
<div class="discussion">
|
975
|
+
<p>Instance level configurations</p>
|
976
|
+
|
977
|
+
|
978
|
+
</div>
|
979
|
+
</div>
|
980
|
+
<div class="tags">
|
981
|
+
|
982
|
+
<p class="tag_title">Returns:</p>
|
983
|
+
<ul class="return">
|
984
|
+
|
985
|
+
<li>
|
986
|
+
|
987
|
+
|
988
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
989
|
+
|
990
|
+
|
991
|
+
|
992
|
+
—
|
993
|
+
<div class='inline'><p>the actual instance configuration</p>
|
994
|
+
</div>
|
995
|
+
|
996
|
+
</li>
|
997
|
+
|
998
|
+
</ul>
|
999
|
+
|
1000
|
+
</div><table class="source_code">
|
1001
|
+
<tr>
|
1002
|
+
<td>
|
1003
|
+
<pre class="lines">
|
1004
|
+
|
1005
|
+
|
1006
|
+
80
|
1007
|
+
81
|
1008
|
+
82</pre>
|
1009
|
+
</td>
|
1010
|
+
<td>
|
1011
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 80</span>
|
1012
|
+
|
1013
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_config'>config</span>
|
1014
|
+
<span class='ivar'>@config</span>
|
1015
|
+
<span class='kw'>end</span></pre>
|
1016
|
+
</td>
|
1017
|
+
</tr>
|
1018
|
+
</table>
|
1019
|
+
</div>
|
1020
|
+
|
1021
|
+
|
1022
|
+
<span id=""></span>
|
1023
|
+
<div class="method_details ">
|
1024
|
+
<h3 class="signature " id="settings-instance_method">
|
1025
|
+
|
1026
|
+
#<strong>settings</strong> ⇒ <tt>Hash</tt> <span class="extras">(readonly)</span>
|
1027
|
+
|
1028
|
+
|
1029
|
+
|
1030
|
+
|
1031
|
+
|
1032
|
+
</h3><div class="docstring">
|
1033
|
+
<div class="discussion">
|
1034
|
+
<p>This is the actual runtime settings used by the adapter
|
1035
|
+
once initialized. During intialization settings could be
|
1036
|
+
overridden. Settings are different from configuration in that
|
1037
|
+
settings control behaviour and syntax while configuration
|
1038
|
+
determines how we connect.</p>
|
1039
|
+
|
1040
|
+
|
1041
|
+
</div>
|
1042
|
+
</div>
|
1043
|
+
<div class="tags">
|
1044
|
+
|
1045
|
+
<p class="tag_title">Returns:</p>
|
1046
|
+
<ul class="return">
|
1047
|
+
|
1048
|
+
<li>
|
1049
|
+
|
1050
|
+
|
1051
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1052
|
+
|
1053
|
+
|
1054
|
+
|
1055
|
+
—
|
1056
|
+
<div class='inline'><p>symbolized hash of settings</p>
|
1057
|
+
</div>
|
1058
|
+
|
1059
|
+
</li>
|
1060
|
+
|
1061
|
+
</ul>
|
1062
|
+
|
1063
|
+
</div><table class="source_code">
|
1064
|
+
<tr>
|
1065
|
+
<td>
|
1066
|
+
<pre class="lines">
|
1067
|
+
|
1068
|
+
|
1069
|
+
100
|
1070
|
+
101
|
1071
|
+
102</pre>
|
1072
|
+
</td>
|
1073
|
+
<td>
|
1074
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 100</span>
|
1075
|
+
|
1076
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_settings'>settings</span>
|
1077
|
+
<span class='ivar'>@settings</span>
|
1078
|
+
<span class='kw'>end</span></pre>
|
1079
|
+
</td>
|
1080
|
+
</tr>
|
1081
|
+
</table>
|
1082
|
+
</div>
|
1083
|
+
|
1084
|
+
</div>
|
1085
|
+
|
1086
|
+
|
1087
|
+
<div id="class_method_details" class="method_details_list">
|
1088
|
+
<h2>Class Method Details</h2>
|
1089
|
+
|
1090
|
+
|
1091
|
+
<div class="method_details first">
|
1092
|
+
<h3 class="signature first" id="config-class_method">
|
1093
|
+
|
1094
|
+
.<strong>config</strong>(name, type, options = {}) ⇒ <tt>Hash</tt>
|
1095
|
+
|
1096
|
+
|
1097
|
+
|
1098
|
+
|
1099
|
+
|
1100
|
+
</h3><div class="docstring">
|
1101
|
+
<div class="discussion">
|
1102
|
+
<p>Define the configurations required for the adapter to
|
1103
|
+
connect and query target database.</p>
|
1104
|
+
|
1105
|
+
|
1106
|
+
</div>
|
1107
|
+
</div>
|
1108
|
+
<div class="tags">
|
1109
|
+
<p class="tag_title">Parameters:</p>
|
1110
|
+
<ul class="param">
|
1111
|
+
|
1112
|
+
<li>
|
1113
|
+
|
1114
|
+
<span class='name'>name</span>
|
1115
|
+
|
1116
|
+
|
1117
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
1118
|
+
|
1119
|
+
|
1120
|
+
|
1121
|
+
—
|
1122
|
+
<div class='inline'><p>name of the configuration</p>
|
1123
|
+
</div>
|
1124
|
+
|
1125
|
+
</li>
|
1126
|
+
|
1127
|
+
<li>
|
1128
|
+
|
1129
|
+
<span class='name'>type</span>
|
1130
|
+
|
1131
|
+
|
1132
|
+
<span class='type'>(<tt>Constant</tt>)</span>
|
1133
|
+
|
1134
|
+
|
1135
|
+
|
1136
|
+
—
|
1137
|
+
<div class='inline'><p>ruby type of the configuration</p>
|
1138
|
+
</div>
|
1139
|
+
|
1140
|
+
</li>
|
1141
|
+
|
1142
|
+
<li>
|
1143
|
+
|
1144
|
+
<span class='name'>options</span>
|
1145
|
+
|
1146
|
+
|
1147
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1148
|
+
|
1149
|
+
|
1150
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1151
|
+
|
1152
|
+
|
1153
|
+
—
|
1154
|
+
<div class='inline'><p>options for the config</p>
|
1155
|
+
</div>
|
1156
|
+
|
1157
|
+
</li>
|
1158
|
+
|
1159
|
+
</ul>
|
1160
|
+
|
1161
|
+
|
1162
|
+
|
1163
|
+
|
1164
|
+
|
1165
|
+
|
1166
|
+
|
1167
|
+
|
1168
|
+
<p class="tag_title">Options Hash (<tt>options</tt>):</p>
|
1169
|
+
<ul class="option">
|
1170
|
+
|
1171
|
+
<li>
|
1172
|
+
<span class="name">:required</span>
|
1173
|
+
<span class="type">(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1174
|
+
<span class="default">
|
1175
|
+
|
1176
|
+
</span>
|
1177
|
+
|
1178
|
+
— <div class='inline'><p>Whether option is required</p>
|
1179
|
+
</div>
|
1180
|
+
|
1181
|
+
</li>
|
1182
|
+
|
1183
|
+
<li>
|
1184
|
+
<span class="name">:default</span>
|
1185
|
+
<span class="type">(<tt>*</tt>)</span>
|
1186
|
+
<span class="default">
|
1187
|
+
|
1188
|
+
</span>
|
1189
|
+
|
1190
|
+
— <div class='inline'><p>The default value</p>
|
1191
|
+
</div>
|
1192
|
+
|
1193
|
+
</li>
|
1194
|
+
|
1195
|
+
<li>
|
1196
|
+
<span class="name">:message</span>
|
1197
|
+
<span class="type">(<tt>String</tt>)</span>
|
1198
|
+
<span class="default">
|
1199
|
+
|
1200
|
+
</span>
|
1201
|
+
|
1202
|
+
— <div class='inline'><p>The error message or info displayed</p>
|
1203
|
+
</div>
|
1204
|
+
|
1205
|
+
</li>
|
1206
|
+
|
1207
|
+
</ul>
|
1208
|
+
|
1209
|
+
|
1210
|
+
<p class="tag_title">Returns:</p>
|
1211
|
+
<ul class="return">
|
1212
|
+
|
1213
|
+
<li>
|
1214
|
+
|
1215
|
+
|
1216
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1217
|
+
|
1218
|
+
|
1219
|
+
|
1220
|
+
</li>
|
1221
|
+
|
1222
|
+
</ul>
|
1223
|
+
|
1224
|
+
</div><table class="source_code">
|
1225
|
+
<tr>
|
1226
|
+
<td>
|
1227
|
+
<pre class="lines">
|
1228
|
+
|
1229
|
+
|
1230
|
+
58
|
1231
|
+
59
|
1232
|
+
60
|
1233
|
+
61
|
1234
|
+
62
|
1235
|
+
63
|
1236
|
+
64
|
1237
|
+
65
|
1238
|
+
66
|
1239
|
+
67
|
1240
|
+
68
|
1241
|
+
69
|
1242
|
+
70</pre>
|
1243
|
+
</td>
|
1244
|
+
<td>
|
1245
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 58</span>
|
1246
|
+
|
1247
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1248
|
+
<span class='id identifier rubyid_configuration'>configuration</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1249
|
+
<span class='label'>type:</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span>
|
1250
|
+
<span class='label'>required:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:required</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>false</span><span class='comma'>,</span>
|
1251
|
+
<span class='label'>default:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1252
|
+
<span class='label'>message:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:message</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid or missing parameter: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
1253
|
+
<span class='label'>allowed:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:allowed</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1254
|
+
<span class='rbrace'>}</span>
|
1255
|
+
|
1256
|
+
<span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1257
|
+
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
1258
|
+
<span class='kw'>end</span>
|
1259
|
+
<span class='kw'>end</span></pre>
|
1260
|
+
</td>
|
1261
|
+
</tr>
|
1262
|
+
</table>
|
1263
|
+
</div>
|
1264
|
+
|
1265
|
+
<div class="method_details ">
|
1266
|
+
<h3 class="signature " id="configuration-class_method">
|
1267
|
+
|
1268
|
+
.<strong>configuration</strong> ⇒ <tt>Hash</tt>
|
1269
|
+
|
1270
|
+
|
1271
|
+
|
1272
|
+
|
1273
|
+
|
1274
|
+
</h3><div class="docstring">
|
1275
|
+
<div class="discussion">
|
1276
|
+
<p>Get the adapter class level configuration settings</p>
|
1277
|
+
|
1278
|
+
|
1279
|
+
</div>
|
1280
|
+
</div>
|
1281
|
+
<div class="tags">
|
1282
|
+
|
1283
|
+
<p class="tag_title">Returns:</p>
|
1284
|
+
<ul class="return">
|
1285
|
+
|
1286
|
+
<li>
|
1287
|
+
|
1288
|
+
|
1289
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1290
|
+
|
1291
|
+
|
1292
|
+
|
1293
|
+
</li>
|
1294
|
+
|
1295
|
+
</ul>
|
1296
|
+
|
1297
|
+
</div><table class="source_code">
|
1298
|
+
<tr>
|
1299
|
+
<td>
|
1300
|
+
<pre class="lines">
|
1301
|
+
|
1302
|
+
|
1303
|
+
74
|
1304
|
+
75
|
1305
|
+
76</pre>
|
1306
|
+
</td>
|
1307
|
+
<td>
|
1308
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 74</span>
|
1309
|
+
|
1310
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_configuration'>configuration</span>
|
1311
|
+
<span class='ivar'>@configuration</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1312
|
+
<span class='kw'>end</span></pre>
|
1313
|
+
</td>
|
1314
|
+
</tr>
|
1315
|
+
</table>
|
1316
|
+
</div>
|
1317
|
+
|
1318
|
+
</div>
|
1319
|
+
|
1320
|
+
<div id="instance_method_details" class="method_details_list">
|
1321
|
+
<h2>Instance Method Details</h2>
|
1322
|
+
|
1323
|
+
|
1324
|
+
<div class="method_details first">
|
1325
|
+
<h3 class="signature first" id="adapter_name-instance_method">
|
1326
|
+
|
1327
|
+
#<strong>adapter_name</strong> ⇒ <tt>String</tt>
|
1328
|
+
|
1329
|
+
|
1330
|
+
|
1331
|
+
|
1332
|
+
|
1333
|
+
</h3><div class="docstring">
|
1334
|
+
<div class="discussion">
|
1335
|
+
<p>Adapter name from the class name</p>
|
1336
|
+
|
1337
|
+
|
1338
|
+
</div>
|
1339
|
+
</div>
|
1340
|
+
<div class="tags">
|
1341
|
+
|
1342
|
+
<p class="tag_title">Returns:</p>
|
1343
|
+
<ul class="return">
|
1344
|
+
|
1345
|
+
<li>
|
1346
|
+
|
1347
|
+
|
1348
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1349
|
+
|
1350
|
+
|
1351
|
+
|
1352
|
+
</li>
|
1353
|
+
|
1354
|
+
</ul>
|
1355
|
+
|
1356
|
+
</div><table class="source_code">
|
1357
|
+
<tr>
|
1358
|
+
<td>
|
1359
|
+
<pre class="lines">
|
1360
|
+
|
1361
|
+
|
1362
|
+
302
|
1363
|
+
303
|
1364
|
+
304</pre>
|
1365
|
+
</td>
|
1366
|
+
<td>
|
1367
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 302</span>
|
1368
|
+
|
1369
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_adapter_name'>adapter_name</span>
|
1370
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_demodulize'>demodulize</span>
|
1371
|
+
<span class='kw'>end</span></pre>
|
1372
|
+
</td>
|
1373
|
+
</tr>
|
1374
|
+
</table>
|
1375
|
+
</div>
|
1376
|
+
|
1377
|
+
<div class="method_details ">
|
1378
|
+
<h3 class="signature " id="alter_settings-instance_method">
|
1379
|
+
|
1380
|
+
#<strong>alter_settings</strong>(changes = {}) ⇒ <tt>Hash</tt>
|
1381
|
+
|
1382
|
+
|
1383
|
+
|
1384
|
+
|
1385
|
+
|
1386
|
+
</h3><div class="docstring">
|
1387
|
+
<div class="discussion">
|
1388
|
+
<p>Allows an already instantiated adapter to change its current settings.
|
1389
|
+
this might be useful in situations where behavior needs to be modified
|
1390
|
+
on runtime basis.</p>
|
1391
|
+
|
1392
|
+
|
1393
|
+
</div>
|
1394
|
+
</div>
|
1395
|
+
<div class="tags">
|
1396
|
+
|
1397
|
+
<p class="tag_title">Returns:</p>
|
1398
|
+
<ul class="return">
|
1399
|
+
|
1400
|
+
<li>
|
1401
|
+
|
1402
|
+
|
1403
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1404
|
+
|
1405
|
+
|
1406
|
+
|
1407
|
+
—
|
1408
|
+
<div class='inline'><p>the complete settings with changes merged</p>
|
1409
|
+
</div>
|
1410
|
+
|
1411
|
+
</li>
|
1412
|
+
|
1413
|
+
</ul>
|
1414
|
+
|
1415
|
+
</div><table class="source_code">
|
1416
|
+
<tr>
|
1417
|
+
<td>
|
1418
|
+
<pre class="lines">
|
1419
|
+
|
1420
|
+
|
1421
|
+
106
|
1422
|
+
107
|
1423
|
+
108
|
1424
|
+
109
|
1425
|
+
110</pre>
|
1426
|
+
</td>
|
1427
|
+
<td>
|
1428
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 106</span>
|
1429
|
+
|
1430
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_alter_settings'>alter_settings</span><span class='lparen'>(</span><span class='id identifier rubyid_changes'>changes</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1431
|
+
<span class='id identifier rubyid_reset_settings'>reset_settings</span> <span class='kw'>unless</span> <span class='ivar'>@original_settings</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1432
|
+
<span class='ivar'>@original_settings</span> <span class='op'>=</span> <span class='ivar'>@settings</span>
|
1433
|
+
<span class='ivar'>@settings</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_changes'>changes</span><span class='rparen'>)</span>
|
1434
|
+
<span class='kw'>end</span></pre>
|
1435
|
+
</td>
|
1436
|
+
</tr>
|
1437
|
+
</table>
|
1438
|
+
</div>
|
1439
|
+
|
1440
|
+
<div class="method_details ">
|
1441
|
+
<h3 class="signature " id="close-instance_method">
|
1442
|
+
|
1443
|
+
#<strong>close</strong> ⇒ <tt>Object</tt>
|
1444
|
+
|
1445
|
+
|
1446
|
+
|
1447
|
+
|
1448
|
+
|
1449
|
+
</h3><div class="docstring">
|
1450
|
+
<div class="discussion">
|
1451
|
+
<p>Close the connection if it was created.</p>
|
1452
|
+
|
1453
|
+
|
1454
|
+
</div>
|
1455
|
+
</div>
|
1456
|
+
<div class="tags">
|
1457
|
+
|
1458
|
+
|
1459
|
+
</div><table class="source_code">
|
1460
|
+
<tr>
|
1461
|
+
<td>
|
1462
|
+
<pre class="lines">
|
1463
|
+
|
1464
|
+
|
1465
|
+
149
|
1466
|
+
150
|
1467
|
+
151
|
1468
|
+
152</pre>
|
1469
|
+
</td>
|
1470
|
+
<td>
|
1471
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 149</span>
|
1472
|
+
|
1473
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
|
1474
|
+
<span class='ivar'>@connection</span><span class='op'>&.</span><span class='id identifier rubyid_close'>close</span>
|
1475
|
+
<span class='ivar'>@connection</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1476
|
+
<span class='kw'>end</span></pre>
|
1477
|
+
</td>
|
1478
|
+
</tr>
|
1479
|
+
</table>
|
1480
|
+
</div>
|
1481
|
+
|
1482
|
+
<div class="method_details ">
|
1483
|
+
<h3 class="signature " id="connect!-instance_method">
|
1484
|
+
|
1485
|
+
#<strong>connect!</strong> ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
1486
|
+
|
1487
|
+
|
1488
|
+
|
1489
|
+
|
1490
|
+
|
1491
|
+
</h3><div class="docstring">
|
1492
|
+
<div class="discussion">
|
1493
|
+
<p>Test connection and raise exception if connection
|
1494
|
+
fails.</p>
|
1495
|
+
|
1496
|
+
|
1497
|
+
</div>
|
1498
|
+
</div>
|
1499
|
+
<div class="tags">
|
1500
|
+
|
1501
|
+
<p class="tag_title">Returns:</p>
|
1502
|
+
<ul class="return">
|
1503
|
+
|
1504
|
+
<li>
|
1505
|
+
|
1506
|
+
|
1507
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1508
|
+
|
1509
|
+
|
1510
|
+
|
1511
|
+
</li>
|
1512
|
+
|
1513
|
+
</ul>
|
1514
|
+
<p class="tag_title">Raises:</p>
|
1515
|
+
<ul class="raise">
|
1516
|
+
|
1517
|
+
<li>
|
1518
|
+
|
1519
|
+
|
1520
|
+
<span class='type'>(<tt><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></tt>)</span>
|
1521
|
+
|
1522
|
+
|
1523
|
+
|
1524
|
+
</li>
|
1525
|
+
|
1526
|
+
</ul>
|
1527
|
+
|
1528
|
+
</div><table class="source_code">
|
1529
|
+
<tr>
|
1530
|
+
<td>
|
1531
|
+
<pre class="lines">
|
1532
|
+
|
1533
|
+
|
1534
|
+
138
|
1535
|
+
139
|
1536
|
+
140</pre>
|
1537
|
+
</td>
|
1538
|
+
<td>
|
1539
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 138</span>
|
1540
|
+
|
1541
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_connect!'>connect!</span>
|
1542
|
+
<span class='id identifier rubyid_test_connection'>test_connection</span><span class='lparen'>(</span><span class='label'>raise_exception:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1543
|
+
<span class='kw'>end</span></pre>
|
1544
|
+
</td>
|
1545
|
+
</tr>
|
1546
|
+
</table>
|
1547
|
+
</div>
|
1548
|
+
|
1549
|
+
<div class="method_details ">
|
1550
|
+
<h3 class="signature " id="connect?-instance_method">
|
1551
|
+
|
1552
|
+
#<strong>connect?</strong> ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
1553
|
+
|
1554
|
+
|
1555
|
+
|
1556
|
+
|
1557
|
+
|
1558
|
+
</h3><div class="docstring">
|
1559
|
+
<div class="discussion">
|
1560
|
+
<p>Tests whether the dtabase can be connected</p>
|
1561
|
+
|
1562
|
+
|
1563
|
+
</div>
|
1564
|
+
</div>
|
1565
|
+
<div class="tags">
|
1566
|
+
|
1567
|
+
<p class="tag_title">Returns:</p>
|
1568
|
+
<ul class="return">
|
1569
|
+
|
1570
|
+
<li>
|
1571
|
+
|
1572
|
+
|
1573
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1574
|
+
|
1575
|
+
|
1576
|
+
|
1577
|
+
</li>
|
1578
|
+
|
1579
|
+
</ul>
|
1580
|
+
|
1581
|
+
</div><table class="source_code">
|
1582
|
+
<tr>
|
1583
|
+
<td>
|
1584
|
+
<pre class="lines">
|
1585
|
+
|
1586
|
+
|
1587
|
+
144
|
1588
|
+
145
|
1589
|
+
146</pre>
|
1590
|
+
</td>
|
1591
|
+
<td>
|
1592
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 144</span>
|
1593
|
+
|
1594
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_connect?'>connect?</span>
|
1595
|
+
<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>
|
1596
|
+
<span class='kw'>end</span></pre>
|
1597
|
+
</td>
|
1598
|
+
</tr>
|
1599
|
+
</table>
|
1600
|
+
</div>
|
1601
|
+
|
1602
|
+
<div class="method_details ">
|
1603
|
+
<h3 class="signature " id="connection-instance_method">
|
1604
|
+
|
1605
|
+
#<strong>connection</strong> ⇒ <tt>Object</tt>
|
1606
|
+
|
1607
|
+
|
1608
|
+
|
1609
|
+
|
1610
|
+
|
1611
|
+
</h3><div class="docstring">
|
1612
|
+
<div class="discussion">
|
1613
|
+
<p>Creates a connection to the target database and returns the
|
1614
|
+
connection object or self</p>
|
1615
|
+
|
1616
|
+
|
1617
|
+
</div>
|
1618
|
+
</div>
|
1619
|
+
<div class="tags">
|
1620
|
+
|
1621
|
+
<p class="tag_title">Raises:</p>
|
1622
|
+
<ul class="raise">
|
1623
|
+
|
1624
|
+
<li>
|
1625
|
+
|
1626
|
+
|
1627
|
+
<span class='type'>(<tt>NotImplementedError</tt>)</span>
|
1628
|
+
|
1629
|
+
|
1630
|
+
|
1631
|
+
</li>
|
1632
|
+
|
1633
|
+
</ul>
|
1634
|
+
|
1635
|
+
</div><table class="source_code">
|
1636
|
+
<tr>
|
1637
|
+
<td>
|
1638
|
+
<pre class="lines">
|
1639
|
+
|
1640
|
+
|
1641
|
+
121
|
1642
|
+
122
|
1643
|
+
123</pre>
|
1644
|
+
</td>
|
1645
|
+
<td>
|
1646
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 121</span>
|
1647
|
+
|
1648
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
|
1649
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> has not implemented method '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1650
|
+
<span class='kw'>end</span></pre>
|
1651
|
+
</td>
|
1652
|
+
</tr>
|
1653
|
+
</table>
|
1654
|
+
</div>
|
1655
|
+
|
1656
|
+
<div class="method_details ">
|
1657
|
+
<h3 class="signature " id="execute-instance_method">
|
1658
|
+
|
1659
|
+
#<strong>execute</strong>(sql, format: :array, retries: 0) ⇒ <tt>Array<Array></tt>, ...
|
1660
|
+
|
1661
|
+
|
1662
|
+
|
1663
|
+
|
1664
|
+
|
1665
|
+
</h3><div class="docstring">
|
1666
|
+
<div class="discussion">
|
1667
|
+
<p>Execute sql on the target database.</p>
|
1668
|
+
|
1669
|
+
|
1670
|
+
</div>
|
1671
|
+
</div>
|
1672
|
+
<div class="tags">
|
1673
|
+
<p class="tag_title">Parameters:</p>
|
1674
|
+
<ul class="param">
|
1675
|
+
|
1676
|
+
<li>
|
1677
|
+
|
1678
|
+
<span class='name'>sql</span>
|
1679
|
+
|
1680
|
+
|
1681
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1682
|
+
|
1683
|
+
|
1684
|
+
|
1685
|
+
—
|
1686
|
+
<div class='inline'><p>actual sql</p>
|
1687
|
+
</div>
|
1688
|
+
|
1689
|
+
</li>
|
1690
|
+
|
1691
|
+
<li>
|
1692
|
+
|
1693
|
+
<span class='name'>format</span>
|
1694
|
+
|
1695
|
+
|
1696
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
1697
|
+
|
1698
|
+
|
1699
|
+
<em class="default">(defaults to: <tt>:array</tt>)</em>
|
1700
|
+
|
1701
|
+
|
1702
|
+
—
|
1703
|
+
<div class='inline'><p>return format type
|
1704
|
+
- array returns array of array
|
1705
|
+
- object returns array of Hashes
|
1706
|
+
- csv returns as csv
|
1707
|
+
- native returns the native result from any clients used
|
1708
|
+
- For example: Postgres using pg client will return PG::Result
|
1709
|
+
- Http clients will returns the HTTP response object</p>
|
1710
|
+
</div>
|
1711
|
+
|
1712
|
+
</li>
|
1713
|
+
|
1714
|
+
<li>
|
1715
|
+
|
1716
|
+
<span class='name'>retries</span>
|
1717
|
+
|
1718
|
+
|
1719
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
1720
|
+
|
1721
|
+
|
1722
|
+
<em class="default">(defaults to: <tt>0</tt>)</em>
|
1723
|
+
|
1724
|
+
|
1725
|
+
—
|
1726
|
+
<div class='inline'><p>number of retries in case of failure. Default is 0</p>
|
1727
|
+
</div>
|
1728
|
+
|
1729
|
+
</li>
|
1730
|
+
|
1731
|
+
</ul>
|
1732
|
+
|
1733
|
+
<p class="tag_title">Returns:</p>
|
1734
|
+
<ul class="return">
|
1735
|
+
|
1736
|
+
<li>
|
1737
|
+
|
1738
|
+
|
1739
|
+
<span class='type'>(<tt>Array<Array></tt>, <tt>Hash</tt>, <tt>CSV</tt>, <tt>Native</tt>)</span>
|
1740
|
+
|
1741
|
+
|
1742
|
+
|
1743
|
+
</li>
|
1744
|
+
|
1745
|
+
</ul>
|
1746
|
+
<p class="tag_title">Raises:</p>
|
1747
|
+
<ul class="raise">
|
1748
|
+
|
1749
|
+
<li>
|
1750
|
+
|
1751
|
+
|
1752
|
+
<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>
|
1753
|
+
|
1754
|
+
|
1755
|
+
|
1756
|
+
</li>
|
1757
|
+
|
1758
|
+
</ul>
|
1759
|
+
|
1760
|
+
</div><table class="source_code">
|
1761
|
+
<tr>
|
1762
|
+
<td>
|
1763
|
+
<pre class="lines">
|
1764
|
+
|
1765
|
+
|
1766
|
+
167
|
1767
|
+
168
|
1768
|
+
169</pre>
|
1769
|
+
</td>
|
1770
|
+
<td>
|
1771
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 167</span>
|
1772
|
+
|
1773
|
+
<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'>0</span><span class='rparen'>)</span>
|
1774
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> has not implemented method '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1775
|
+
<span class='kw'>end</span></pre>
|
1776
|
+
</td>
|
1777
|
+
</tr>
|
1778
|
+
</table>
|
1779
|
+
</div>
|
1780
|
+
|
1781
|
+
<div class="method_details ">
|
1782
|
+
<h3 class="signature " id="execute_stream-instance_method">
|
1783
|
+
|
1784
|
+
#<strong>execute_stream</strong>(sql, io, stats: nil, retries: 0) ⇒ <tt>IO</tt>
|
1785
|
+
|
1786
|
+
|
1787
|
+
|
1788
|
+
|
1789
|
+
|
1790
|
+
</h3><div class="docstring">
|
1791
|
+
<div class="discussion">
|
1792
|
+
<p>Execute sql and stream responses back. Data is writtent out in CSV format
|
1793
|
+
to the provided IO object.</p>
|
1794
|
+
|
1795
|
+
|
1796
|
+
</div>
|
1797
|
+
</div>
|
1798
|
+
<div class="tags">
|
1799
|
+
<p class="tag_title">Parameters:</p>
|
1800
|
+
<ul class="param">
|
1801
|
+
|
1802
|
+
<li>
|
1803
|
+
|
1804
|
+
<span class='name'>sql</span>
|
1805
|
+
|
1806
|
+
|
1807
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1808
|
+
|
1809
|
+
|
1810
|
+
|
1811
|
+
—
|
1812
|
+
<div class='inline'><p>actual sql</p>
|
1813
|
+
</div>
|
1814
|
+
|
1815
|
+
</li>
|
1816
|
+
|
1817
|
+
<li>
|
1818
|
+
|
1819
|
+
<span class='name'>io</span>
|
1820
|
+
|
1821
|
+
|
1822
|
+
<span class='type'>(<tt>IO</tt>)</span>
|
1823
|
+
|
1824
|
+
|
1825
|
+
|
1826
|
+
—
|
1827
|
+
<div class='inline'><p>IO object to write records to</p>
|
1828
|
+
</div>
|
1829
|
+
|
1830
|
+
</li>
|
1831
|
+
|
1832
|
+
<li>
|
1833
|
+
|
1834
|
+
<span class='name'>stats</span>
|
1835
|
+
|
1836
|
+
|
1837
|
+
<span class='type'>(<tt><span class='object_link'><a href="../StreamingStats.html" title="DWH::StreamingStats (class)">StreamingStats</a></span></tt>)</span>
|
1838
|
+
|
1839
|
+
|
1840
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1841
|
+
|
1842
|
+
|
1843
|
+
—
|
1844
|
+
<div class='inline'><p>collect stats and preview data this is optional</p>
|
1845
|
+
</div>
|
1846
|
+
|
1847
|
+
</li>
|
1848
|
+
|
1849
|
+
<li>
|
1850
|
+
|
1851
|
+
<span class='name'>retries</span>
|
1852
|
+
|
1853
|
+
|
1854
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
1855
|
+
|
1856
|
+
|
1857
|
+
<em class="default">(defaults to: <tt>0</tt>)</em>
|
1858
|
+
|
1859
|
+
|
1860
|
+
—
|
1861
|
+
<div class='inline'><p>number of retries in case of failure</p>
|
1862
|
+
</div>
|
1863
|
+
|
1864
|
+
</li>
|
1865
|
+
|
1866
|
+
</ul>
|
1867
|
+
|
1868
|
+
<p class="tag_title">Returns:</p>
|
1869
|
+
<ul class="return">
|
1870
|
+
|
1871
|
+
<li>
|
1872
|
+
|
1873
|
+
|
1874
|
+
<span class='type'>(<tt>IO</tt>)</span>
|
1875
|
+
|
1876
|
+
|
1877
|
+
|
1878
|
+
</li>
|
1879
|
+
|
1880
|
+
</ul>
|
1881
|
+
<p class="tag_title">Raises:</p>
|
1882
|
+
<ul class="raise">
|
1883
|
+
|
1884
|
+
<li>
|
1885
|
+
|
1886
|
+
|
1887
|
+
<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>
|
1888
|
+
|
1889
|
+
|
1890
|
+
|
1891
|
+
</li>
|
1892
|
+
|
1893
|
+
</ul>
|
1894
|
+
|
1895
|
+
</div><table class="source_code">
|
1896
|
+
<tr>
|
1897
|
+
<td>
|
1898
|
+
<pre class="lines">
|
1899
|
+
|
1900
|
+
|
1901
|
+
180
|
1902
|
+
181
|
1903
|
+
182</pre>
|
1904
|
+
</td>
|
1905
|
+
<td>
|
1906
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 180</span>
|
1907
|
+
|
1908
|
+
<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'>0</span><span class='rparen'>)</span>
|
1909
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> has not implemented method '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1910
|
+
<span class='kw'>end</span></pre>
|
1911
|
+
</td>
|
1912
|
+
</tr>
|
1913
|
+
</table>
|
1914
|
+
</div>
|
1915
|
+
|
1916
|
+
<div class="method_details ">
|
1917
|
+
<h3 class="signature " id="extra_connection_params-instance_method">
|
1918
|
+
|
1919
|
+
#<strong>extra_connection_params</strong> ⇒ <tt>Hash</tt>
|
1920
|
+
|
1921
|
+
|
1922
|
+
|
1923
|
+
|
1924
|
+
|
1925
|
+
</h3><div class="docstring">
|
1926
|
+
<div class="discussion">
|
1927
|
+
<p>If any extra connection params were passed in the config
|
1928
|
+
object, this will return it.</p>
|
1929
|
+
|
1930
|
+
|
1931
|
+
</div>
|
1932
|
+
</div>
|
1933
|
+
<div class="tags">
|
1934
|
+
|
1935
|
+
<p class="tag_title">Returns:</p>
|
1936
|
+
<ul class="return">
|
1937
|
+
|
1938
|
+
<li>
|
1939
|
+
|
1940
|
+
|
1941
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1942
|
+
|
1943
|
+
|
1944
|
+
|
1945
|
+
—
|
1946
|
+
<div class='inline'><p>default empty hash</p>
|
1947
|
+
</div>
|
1948
|
+
|
1949
|
+
</li>
|
1950
|
+
|
1951
|
+
</ul>
|
1952
|
+
|
1953
|
+
</div><table class="source_code">
|
1954
|
+
<tr>
|
1955
|
+
<td>
|
1956
|
+
<pre class="lines">
|
1957
|
+
|
1958
|
+
|
1959
|
+
310
|
1960
|
+
311
|
1961
|
+
312</pre>
|
1962
|
+
</td>
|
1963
|
+
<td>
|
1964
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 310</span>
|
1965
|
+
|
1966
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_extra_connection_params'>extra_connection_params</span>
|
1967
|
+
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:extra_connection_params</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1968
|
+
<span class='kw'>end</span></pre>
|
1969
|
+
</td>
|
1970
|
+
</tr>
|
1971
|
+
</table>
|
1972
|
+
</div>
|
1973
|
+
|
1974
|
+
<div class="method_details ">
|
1975
|
+
<h3 class="signature " id="extra_query_params-instance_method">
|
1976
|
+
|
1977
|
+
#<strong>extra_query_params</strong> ⇒ <tt>Hash</tt>
|
1978
|
+
|
1979
|
+
|
1980
|
+
|
1981
|
+
|
1982
|
+
|
1983
|
+
</h3><div class="docstring">
|
1984
|
+
<div class="discussion">
|
1985
|
+
<p>If the adapter supports it, will pass on extra query params
|
1986
|
+
from the config to the executor.</p>
|
1987
|
+
|
1988
|
+
|
1989
|
+
</div>
|
1990
|
+
</div>
|
1991
|
+
<div class="tags">
|
1992
|
+
|
1993
|
+
<p class="tag_title">Returns:</p>
|
1994
|
+
<ul class="return">
|
1995
|
+
|
1996
|
+
<li>
|
1997
|
+
|
1998
|
+
|
1999
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2000
|
+
|
2001
|
+
|
2002
|
+
|
2003
|
+
—
|
2004
|
+
<div class='inline'><p>default empty hash</p>
|
2005
|
+
</div>
|
2006
|
+
|
2007
|
+
</li>
|
2008
|
+
|
2009
|
+
</ul>
|
2010
|
+
|
2011
|
+
</div><table class="source_code">
|
2012
|
+
<tr>
|
2013
|
+
<td>
|
2014
|
+
<pre class="lines">
|
2015
|
+
|
2016
|
+
|
2017
|
+
318
|
2018
|
+
319
|
2019
|
+
320</pre>
|
2020
|
+
</td>
|
2021
|
+
<td>
|
2022
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 318</span>
|
2023
|
+
|
2024
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_extra_query_params'>extra_query_params</span>
|
2025
|
+
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:extra_query_params</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
2026
|
+
<span class='kw'>end</span></pre>
|
2027
|
+
</td>
|
2028
|
+
</tr>
|
2029
|
+
</table>
|
2030
|
+
</div>
|
2031
|
+
|
2032
|
+
<div class="method_details ">
|
2033
|
+
<h3 class="signature " id="metadata-instance_method">
|
2034
|
+
|
2035
|
+
#<strong>metadata</strong>(table, **qualifiers) ⇒ <tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>
|
2036
|
+
|
2037
|
+
|
2038
|
+
|
2039
|
+
|
2040
|
+
|
2041
|
+
</h3><div class="docstring">
|
2042
|
+
<div class="discussion">
|
2043
|
+
<p>Get the schema structure of a given a given table_name.
|
2044
|
+
Pass in optional catalog and schema info.</p>
|
2045
|
+
|
2046
|
+
<p>Example:
|
2047
|
+
metadata(“public.big_table”)
|
2048
|
+
metadata(“big_table”)
|
2049
|
+
metadata(“big_table”,schema: “public”)</p>
|
2050
|
+
|
2051
|
+
|
2052
|
+
</div>
|
2053
|
+
</div>
|
2054
|
+
<div class="tags">
|
2055
|
+
<p class="tag_title">Parameters:</p>
|
2056
|
+
<ul class="param">
|
2057
|
+
|
2058
|
+
<li>
|
2059
|
+
|
2060
|
+
<span class='name'>table</span>
|
2061
|
+
|
2062
|
+
|
2063
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2064
|
+
|
2065
|
+
|
2066
|
+
|
2067
|
+
—
|
2068
|
+
<div class='inline'><ul>
|
2069
|
+
<li>table name</li>
|
2070
|
+
</ul>
|
2071
|
+
</div>
|
2072
|
+
|
2073
|
+
</li>
|
2074
|
+
|
2075
|
+
<li>
|
2076
|
+
|
2077
|
+
<span class='name'>qualifiers</span>
|
2078
|
+
|
2079
|
+
|
2080
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2081
|
+
|
2082
|
+
|
2083
|
+
|
2084
|
+
—
|
2085
|
+
<div class='inline'><p>a customizable set of options</p>
|
2086
|
+
</div>
|
2087
|
+
|
2088
|
+
</li>
|
2089
|
+
|
2090
|
+
</ul>
|
2091
|
+
|
2092
|
+
|
2093
|
+
|
2094
|
+
|
2095
|
+
|
2096
|
+
|
2097
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
2098
|
+
<ul class="option">
|
2099
|
+
|
2100
|
+
<li>
|
2101
|
+
<span class="name">:catalog</span>
|
2102
|
+
<span class="type">(<tt>String</tt>)</span>
|
2103
|
+
<span class="default">
|
2104
|
+
|
2105
|
+
</span>
|
2106
|
+
|
2107
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
2108
|
+
will be ignored if the adapter doesn’t support</p>
|
2109
|
+
</div>
|
2110
|
+
|
2111
|
+
</li>
|
2112
|
+
|
2113
|
+
<li>
|
2114
|
+
<span class="name">:schema</span>
|
2115
|
+
<span class="type">(<tt>String</tt>)</span>
|
2116
|
+
<span class="default">
|
2117
|
+
|
2118
|
+
</span>
|
2119
|
+
|
2120
|
+
— <div class='inline'><p>optional schema to scope to.
|
2121
|
+
will be ignored if the adapter doesn’t support</p>
|
2122
|
+
</div>
|
2123
|
+
|
2124
|
+
</li>
|
2125
|
+
|
2126
|
+
</ul>
|
2127
|
+
|
2128
|
+
|
2129
|
+
<p class="tag_title">Returns:</p>
|
2130
|
+
<ul class="return">
|
2131
|
+
|
2132
|
+
<li>
|
2133
|
+
|
2134
|
+
|
2135
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>)</span>
|
2136
|
+
|
2137
|
+
|
2138
|
+
|
2139
|
+
</li>
|
2140
|
+
|
2141
|
+
</ul>
|
2142
|
+
<p class="tag_title">Raises:</p>
|
2143
|
+
<ul class="raise">
|
2144
|
+
|
2145
|
+
<li>
|
2146
|
+
|
2147
|
+
|
2148
|
+
<span class='type'>(<tt>NotImplementedError</tt>)</span>
|
2149
|
+
|
2150
|
+
|
2151
|
+
|
2152
|
+
</li>
|
2153
|
+
|
2154
|
+
</ul>
|
2155
|
+
|
2156
|
+
</div><table class="source_code">
|
2157
|
+
<tr>
|
2158
|
+
<td>
|
2159
|
+
<pre class="lines">
|
2160
|
+
|
2161
|
+
|
2162
|
+
253
|
2163
|
+
254
|
2164
|
+
255</pre>
|
2165
|
+
</td>
|
2166
|
+
<td>
|
2167
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 253</span>
|
2168
|
+
|
2169
|
+
<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>
|
2170
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> has not implemented method '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
2171
|
+
<span class='kw'>end</span></pre>
|
2172
|
+
</td>
|
2173
|
+
</tr>
|
2174
|
+
</table>
|
2175
|
+
</div>
|
2176
|
+
|
2177
|
+
<div class="method_details ">
|
2178
|
+
<h3 class="signature " id="reset_settings-instance_method">
|
2179
|
+
|
2180
|
+
#<strong>reset_settings</strong> ⇒ <tt>Hash</tt>
|
2181
|
+
|
2182
|
+
|
2183
|
+
|
2184
|
+
|
2185
|
+
|
2186
|
+
</h3><div class="docstring">
|
2187
|
+
<div class="discussion">
|
2188
|
+
<p>This returns settings back to its original state prior to
|
2189
|
+
running alter_settings.</p>
|
2190
|
+
|
2191
|
+
|
2192
|
+
</div>
|
2193
|
+
</div>
|
2194
|
+
<div class="tags">
|
2195
|
+
|
2196
|
+
<p class="tag_title">Returns:</p>
|
2197
|
+
<ul class="return">
|
2198
|
+
|
2199
|
+
<li>
|
2200
|
+
|
2201
|
+
|
2202
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2203
|
+
|
2204
|
+
|
2205
|
+
|
2206
|
+
—
|
2207
|
+
<div class='inline'><p>with original settings</p>
|
2208
|
+
</div>
|
2209
|
+
|
2210
|
+
</li>
|
2211
|
+
|
2212
|
+
</ul>
|
2213
|
+
|
2214
|
+
</div><table class="source_code">
|
2215
|
+
<tr>
|
2216
|
+
<td>
|
2217
|
+
<pre class="lines">
|
2218
|
+
|
2219
|
+
|
2220
|
+
115
|
2221
|
+
116
|
2222
|
+
117</pre>
|
2223
|
+
</td>
|
2224
|
+
<td>
|
2225
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 115</span>
|
2226
|
+
|
2227
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset_settings'>reset_settings</span>
|
2228
|
+
<span class='ivar'>@settings</span> <span class='op'>=</span> <span class='ivar'>@original_settings</span> <span class='kw'>if</span> <span class='ivar'>@original_settings</span>
|
2229
|
+
<span class='kw'>end</span></pre>
|
2230
|
+
</td>
|
2231
|
+
</tr>
|
2232
|
+
</table>
|
2233
|
+
</div>
|
2234
|
+
|
2235
|
+
<div class="method_details ">
|
2236
|
+
<h3 class="signature " id="stats-instance_method">
|
2237
|
+
|
2238
|
+
#<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>
|
2239
|
+
|
2240
|
+
|
2241
|
+
|
2242
|
+
|
2243
|
+
|
2244
|
+
</h3><div class="docstring">
|
2245
|
+
<div class="discussion">
|
2246
|
+
<p>Returns basic stats of a given table. Will typically include row_count,
|
2247
|
+
date_start, and date_end.</p>
|
2248
|
+
|
2249
|
+
|
2250
|
+
</div>
|
2251
|
+
</div>
|
2252
|
+
<div class="tags">
|
2253
|
+
|
2254
|
+
<div class="examples">
|
2255
|
+
<h4 class="tag_title">Examples:</h4>
|
2256
|
+
|
2257
|
+
|
2258
|
+
<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>
|
2259
|
+
<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>
|
2260
|
+
<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>
|
2261
|
+
|
2262
|
+
</div>
|
2263
|
+
<p class="tag_title">Parameters:</p>
|
2264
|
+
<ul class="param">
|
2265
|
+
|
2266
|
+
<li>
|
2267
|
+
|
2268
|
+
<span class='name'>table</span>
|
2269
|
+
|
2270
|
+
|
2271
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2272
|
+
|
2273
|
+
|
2274
|
+
|
2275
|
+
—
|
2276
|
+
<div class='inline'><p>table name</p>
|
2277
|
+
</div>
|
2278
|
+
|
2279
|
+
</li>
|
2280
|
+
|
2281
|
+
<li>
|
2282
|
+
|
2283
|
+
<span class='name'>date_column</span>
|
2284
|
+
|
2285
|
+
|
2286
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2287
|
+
|
2288
|
+
|
2289
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2290
|
+
|
2291
|
+
|
2292
|
+
—
|
2293
|
+
<div class='inline'><p>optional date column to use to find range</p>
|
2294
|
+
</div>
|
2295
|
+
|
2296
|
+
</li>
|
2297
|
+
|
2298
|
+
<li>
|
2299
|
+
|
2300
|
+
<span class='name'>qualifiers</span>
|
2301
|
+
|
2302
|
+
|
2303
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2304
|
+
|
2305
|
+
|
2306
|
+
|
2307
|
+
—
|
2308
|
+
<div class='inline'><p>a customizable set of options</p>
|
2309
|
+
</div>
|
2310
|
+
|
2311
|
+
</li>
|
2312
|
+
|
2313
|
+
</ul>
|
2314
|
+
|
2315
|
+
|
2316
|
+
|
2317
|
+
|
2318
|
+
|
2319
|
+
|
2320
|
+
|
2321
|
+
|
2322
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
2323
|
+
<ul class="option">
|
2324
|
+
|
2325
|
+
<li>
|
2326
|
+
<span class="name">:catalog</span>
|
2327
|
+
<span class="type">(<tt>String</tt>)</span>
|
2328
|
+
<span class="default">
|
2329
|
+
|
2330
|
+
</span>
|
2331
|
+
|
2332
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
2333
|
+
will be ignored if the adapter doesn’t support</p>
|
2334
|
+
</div>
|
2335
|
+
|
2336
|
+
</li>
|
2337
|
+
|
2338
|
+
<li>
|
2339
|
+
<span class="name">:schema</span>
|
2340
|
+
<span class="type">(<tt>String</tt>)</span>
|
2341
|
+
<span class="default">
|
2342
|
+
|
2343
|
+
</span>
|
2344
|
+
|
2345
|
+
— <div class='inline'><p>optional schema to scope to.
|
2346
|
+
will be ignored if the adapter doesn’t support</p>
|
2347
|
+
</div>
|
2348
|
+
|
2349
|
+
</li>
|
2350
|
+
|
2351
|
+
</ul>
|
2352
|
+
|
2353
|
+
|
2354
|
+
<p class="tag_title">Returns:</p>
|
2355
|
+
<ul class="return">
|
2356
|
+
|
2357
|
+
<li>
|
2358
|
+
|
2359
|
+
|
2360
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>)</span>
|
2361
|
+
|
2362
|
+
|
2363
|
+
|
2364
|
+
</li>
|
2365
|
+
|
2366
|
+
</ul>
|
2367
|
+
<p class="tag_title">Raises:</p>
|
2368
|
+
<ul class="raise">
|
2369
|
+
|
2370
|
+
<li>
|
2371
|
+
|
2372
|
+
|
2373
|
+
<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>
|
2374
|
+
|
2375
|
+
|
2376
|
+
|
2377
|
+
</li>
|
2378
|
+
|
2379
|
+
</ul>
|
2380
|
+
|
2381
|
+
</div><table class="source_code">
|
2382
|
+
<tr>
|
2383
|
+
<td>
|
2384
|
+
<pre class="lines">
|
2385
|
+
|
2386
|
+
|
2387
|
+
211
|
2388
|
+
212
|
2389
|
+
213</pre>
|
2390
|
+
</td>
|
2391
|
+
<td>
|
2392
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 211</span>
|
2393
|
+
|
2394
|
+
<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>
|
2395
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> has not implemented method '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
2396
|
+
<span class='kw'>end</span></pre>
|
2397
|
+
</td>
|
2398
|
+
</tr>
|
2399
|
+
</table>
|
2400
|
+
</div>
|
2401
|
+
|
2402
|
+
<div class="method_details ">
|
2403
|
+
<h3 class="signature " id="stream-instance_method">
|
2404
|
+
|
2405
|
+
#<strong>stream</strong>(sql) {|chunk| ... } ⇒ <tt>Object</tt>
|
2406
|
+
|
2407
|
+
|
2408
|
+
|
2409
|
+
|
2410
|
+
|
2411
|
+
</h3><div class="docstring">
|
2412
|
+
<div class="discussion">
|
2413
|
+
<p>Executes the given sql and yields the streamed results
|
2414
|
+
to the given block.</p>
|
2415
|
+
|
2416
|
+
|
2417
|
+
</div>
|
2418
|
+
</div>
|
2419
|
+
<div class="tags">
|
2420
|
+
<p class="tag_title">Parameters:</p>
|
2421
|
+
<ul class="param">
|
2422
|
+
|
2423
|
+
<li>
|
2424
|
+
|
2425
|
+
<span class='name'>sql</span>
|
2426
|
+
|
2427
|
+
|
2428
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2429
|
+
|
2430
|
+
|
2431
|
+
|
2432
|
+
—
|
2433
|
+
<div class='inline'><p>actual sql</p>
|
2434
|
+
</div>
|
2435
|
+
|
2436
|
+
</li>
|
2437
|
+
|
2438
|
+
</ul>
|
2439
|
+
|
2440
|
+
<p class="tag_title">Yields:</p>
|
2441
|
+
<ul class="yield">
|
2442
|
+
|
2443
|
+
<li>
|
2444
|
+
|
2445
|
+
|
2446
|
+
<span class='type'>(<tt>chunk</tt>)</span>
|
2447
|
+
|
2448
|
+
|
2449
|
+
|
2450
|
+
—
|
2451
|
+
<div class='inline'><p>Yields a streamed chunk as it streams in. The chunk type
|
2452
|
+
might vary depending on the target db and settings</p>
|
2453
|
+
</div>
|
2454
|
+
|
2455
|
+
</li>
|
2456
|
+
|
2457
|
+
</ul>
|
2458
|
+
<p class="tag_title">Raises:</p>
|
2459
|
+
<ul class="raise">
|
2460
|
+
|
2461
|
+
<li>
|
2462
|
+
|
2463
|
+
|
2464
|
+
<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>
|
2465
|
+
|
2466
|
+
|
2467
|
+
|
2468
|
+
</li>
|
2469
|
+
|
2470
|
+
</ul>
|
2471
|
+
|
2472
|
+
</div><table class="source_code">
|
2473
|
+
<tr>
|
2474
|
+
<td>
|
2475
|
+
<pre class="lines">
|
2476
|
+
|
2477
|
+
|
2478
|
+
191
|
2479
|
+
192
|
2480
|
+
193</pre>
|
2481
|
+
</td>
|
2482
|
+
<td>
|
2483
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 191</span>
|
2484
|
+
|
2485
|
+
<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>
|
2486
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> has not implemented method '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
2487
|
+
<span class='kw'>end</span></pre>
|
2488
|
+
</td>
|
2489
|
+
</tr>
|
2490
|
+
</table>
|
2491
|
+
</div>
|
2492
|
+
|
2493
|
+
<div class="method_details ">
|
2494
|
+
<h3 class="signature " id="table?-instance_method">
|
2495
|
+
|
2496
|
+
#<strong>table?</strong>(table, **qualifiers) ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
2497
|
+
|
2498
|
+
|
2499
|
+
|
2500
|
+
|
2501
|
+
|
2502
|
+
</h3><div class="docstring">
|
2503
|
+
<div class="discussion">
|
2504
|
+
<p>Check if table exists in remote db.</p>
|
2505
|
+
|
2506
|
+
|
2507
|
+
</div>
|
2508
|
+
</div>
|
2509
|
+
<div class="tags">
|
2510
|
+
<p class="tag_title">Parameters:</p>
|
2511
|
+
<ul class="param">
|
2512
|
+
|
2513
|
+
<li>
|
2514
|
+
|
2515
|
+
<span class='name'>qualifiers</span>
|
2516
|
+
|
2517
|
+
|
2518
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2519
|
+
|
2520
|
+
|
2521
|
+
|
2522
|
+
—
|
2523
|
+
<div class='inline'><p>a customizable set of options</p>
|
2524
|
+
</div>
|
2525
|
+
|
2526
|
+
</li>
|
2527
|
+
|
2528
|
+
</ul>
|
2529
|
+
|
2530
|
+
|
2531
|
+
|
2532
|
+
|
2533
|
+
|
2534
|
+
|
2535
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
2536
|
+
<ul class="option">
|
2537
|
+
|
2538
|
+
<li>
|
2539
|
+
<span class="name">:catalog</span>
|
2540
|
+
<span class="type">(<tt>String</tt>)</span>
|
2541
|
+
<span class="default">
|
2542
|
+
|
2543
|
+
</span>
|
2544
|
+
|
2545
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
2546
|
+
will be ignored if the adapter doesn’t support</p>
|
2547
|
+
</div>
|
2548
|
+
|
2549
|
+
</li>
|
2550
|
+
|
2551
|
+
<li>
|
2552
|
+
<span class="name">:schema</span>
|
2553
|
+
<span class="type">(<tt>String</tt>)</span>
|
2554
|
+
<span class="default">
|
2555
|
+
|
2556
|
+
</span>
|
2557
|
+
|
2558
|
+
— <div class='inline'><p>optional schema to scope to.
|
2559
|
+
will be ignored if the adapter doesn’t support</p>
|
2560
|
+
</div>
|
2561
|
+
|
2562
|
+
</li>
|
2563
|
+
|
2564
|
+
</ul>
|
2565
|
+
|
2566
|
+
|
2567
|
+
<p class="tag_title">Returns:</p>
|
2568
|
+
<ul class="return">
|
2569
|
+
|
2570
|
+
<li>
|
2571
|
+
|
2572
|
+
|
2573
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
2574
|
+
|
2575
|
+
|
2576
|
+
|
2577
|
+
</li>
|
2578
|
+
|
2579
|
+
</ul>
|
2580
|
+
|
2581
|
+
</div><table class="source_code">
|
2582
|
+
<tr>
|
2583
|
+
<td>
|
2584
|
+
<pre class="lines">
|
2585
|
+
|
2586
|
+
|
2587
|
+
235
|
2588
|
+
236
|
2589
|
+
237</pre>
|
2590
|
+
</td>
|
2591
|
+
<td>
|
2592
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 235</span>
|
2593
|
+
|
2594
|
+
<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>
|
2595
|
+
<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><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_table'>table</span><span class='rparen'>)</span>
|
2596
|
+
<span class='kw'>end</span></pre>
|
2597
|
+
</td>
|
2598
|
+
</tr>
|
2599
|
+
</table>
|
2600
|
+
</div>
|
2601
|
+
|
2602
|
+
<div class="method_details ">
|
2603
|
+
<h3 class="signature " id="tables-instance_method">
|
2604
|
+
|
2605
|
+
#<strong>tables</strong>(**qualifiers) ⇒ <tt>Array<String></tt>
|
2606
|
+
|
2607
|
+
|
2608
|
+
|
2609
|
+
|
2610
|
+
|
2611
|
+
</h3><div class="docstring">
|
2612
|
+
<div class="discussion">
|
2613
|
+
<p>Get all tables available in the
|
2614
|
+
target db. It will use the default catalog and schema
|
2615
|
+
config only specified here.</p>
|
2616
|
+
|
2617
|
+
|
2618
|
+
</div>
|
2619
|
+
</div>
|
2620
|
+
<div class="tags">
|
2621
|
+
<p class="tag_title">Parameters:</p>
|
2622
|
+
<ul class="param">
|
2623
|
+
|
2624
|
+
<li>
|
2625
|
+
|
2626
|
+
<span class='name'>qualifiers</span>
|
2627
|
+
|
2628
|
+
|
2629
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2630
|
+
|
2631
|
+
|
2632
|
+
|
2633
|
+
—
|
2634
|
+
<div class='inline'><p>a customizable set of options</p>
|
2635
|
+
</div>
|
2636
|
+
|
2637
|
+
</li>
|
2638
|
+
|
2639
|
+
</ul>
|
2640
|
+
|
2641
|
+
|
2642
|
+
|
2643
|
+
|
2644
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
2645
|
+
<ul class="option">
|
2646
|
+
|
2647
|
+
<li>
|
2648
|
+
<span class="name">:catalog</span>
|
2649
|
+
<span class="type">(<tt>String</tt>)</span>
|
2650
|
+
<span class="default">
|
2651
|
+
|
2652
|
+
</span>
|
2653
|
+
|
2654
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
2655
|
+
will be ignored if the adapter doesn’t support</p>
|
2656
|
+
</div>
|
2657
|
+
|
2658
|
+
</li>
|
2659
|
+
|
2660
|
+
<li>
|
2661
|
+
<span class="name">:schema</span>
|
2662
|
+
<span class="type">(<tt>String</tt>)</span>
|
2663
|
+
<span class="default">
|
2664
|
+
|
2665
|
+
</span>
|
2666
|
+
|
2667
|
+
— <div class='inline'><p>optional schema to scope to.
|
2668
|
+
will be ignored if the adapter doesn’t support</p>
|
2669
|
+
</div>
|
2670
|
+
|
2671
|
+
</li>
|
2672
|
+
|
2673
|
+
</ul>
|
2674
|
+
|
2675
|
+
|
2676
|
+
<p class="tag_title">Returns:</p>
|
2677
|
+
<ul class="return">
|
2678
|
+
|
2679
|
+
<li>
|
2680
|
+
|
2681
|
+
|
2682
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
2683
|
+
|
2684
|
+
|
2685
|
+
|
2686
|
+
</li>
|
2687
|
+
|
2688
|
+
</ul>
|
2689
|
+
<p class="tag_title">Raises:</p>
|
2690
|
+
<ul class="raise">
|
2691
|
+
|
2692
|
+
<li>
|
2693
|
+
|
2694
|
+
|
2695
|
+
<span class='type'>(<tt>NotImplementedError</tt>)</span>
|
2696
|
+
|
2697
|
+
|
2698
|
+
|
2699
|
+
</li>
|
2700
|
+
|
2701
|
+
</ul>
|
2702
|
+
|
2703
|
+
</div><table class="source_code">
|
2704
|
+
<tr>
|
2705
|
+
<td>
|
2706
|
+
<pre class="lines">
|
2707
|
+
|
2708
|
+
|
2709
|
+
224
|
2710
|
+
225
|
2711
|
+
226</pre>
|
2712
|
+
</td>
|
2713
|
+
<td>
|
2714
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 224</span>
|
2715
|
+
|
2716
|
+
<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>
|
2717
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> has not implemented method '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
2718
|
+
<span class='kw'>end</span></pre>
|
2719
|
+
</td>
|
2720
|
+
</tr>
|
2721
|
+
</table>
|
2722
|
+
</div>
|
2723
|
+
|
2724
|
+
<div class="method_details ">
|
2725
|
+
<h3 class="signature " id="test_connection-instance_method">
|
2726
|
+
|
2727
|
+
#<strong>test_connection</strong>(raise_exception: false) ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
2728
|
+
|
2729
|
+
|
2730
|
+
|
2731
|
+
|
2732
|
+
|
2733
|
+
</h3><div class="docstring">
|
2734
|
+
<div class="discussion">
|
2735
|
+
<p>Tests the connection to the target database and returns true
|
2736
|
+
if successful, or raise Exception or false
|
2737
|
+
connection object or self</p>
|
2738
|
+
|
2739
|
+
|
2740
|
+
</div>
|
2741
|
+
</div>
|
2742
|
+
<div class="tags">
|
2743
|
+
|
2744
|
+
<p class="tag_title">Returns:</p>
|
2745
|
+
<ul class="return">
|
2746
|
+
|
2747
|
+
<li>
|
2748
|
+
|
2749
|
+
|
2750
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
2751
|
+
|
2752
|
+
|
2753
|
+
|
2754
|
+
</li>
|
2755
|
+
|
2756
|
+
</ul>
|
2757
|
+
<p class="tag_title">Raises:</p>
|
2758
|
+
<ul class="raise">
|
2759
|
+
|
2760
|
+
<li>
|
2761
|
+
|
2762
|
+
|
2763
|
+
<span class='type'>(<tt><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></tt>)</span>
|
2764
|
+
|
2765
|
+
|
2766
|
+
|
2767
|
+
—
|
2768
|
+
<div class='inline'><p>when a connection cannot be made</p>
|
2769
|
+
</div>
|
2770
|
+
|
2771
|
+
</li>
|
2772
|
+
|
2773
|
+
</ul>
|
2774
|
+
|
2775
|
+
</div><table class="source_code">
|
2776
|
+
<tr>
|
2777
|
+
<td>
|
2778
|
+
<pre class="lines">
|
2779
|
+
|
2780
|
+
|
2781
|
+
130
|
2782
|
+
131
|
2783
|
+
132</pre>
|
2784
|
+
</td>
|
2785
|
+
<td>
|
2786
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 130</span>
|
2787
|
+
|
2788
|
+
<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>
|
2789
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> has not implemented method '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
2790
|
+
<span class='kw'>end</span></pre>
|
2791
|
+
</td>
|
2792
|
+
</tr>
|
2793
|
+
</table>
|
2794
|
+
</div>
|
2795
|
+
|
2796
|
+
<div class="method_details ">
|
2797
|
+
<h3 class="signature " id="token_expired?-instance_method">
|
2798
|
+
|
2799
|
+
#<strong>token_expired?</strong> ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
2800
|
+
|
2801
|
+
|
2802
|
+
|
2803
|
+
|
2804
|
+
|
2805
|
+
</h3><div class="docstring">
|
2806
|
+
<div class="discussion">
|
2807
|
+
<p>For adapters that uses access tokens via
|
2808
|
+
jwt or oauth this will return wether a tokens is
|
2809
|
+
expired</p>
|
2810
|
+
|
2811
|
+
|
2812
|
+
</div>
|
2813
|
+
</div>
|
2814
|
+
<div class="tags">
|
2815
|
+
|
2816
|
+
<p class="tag_title">Returns:</p>
|
2817
|
+
<ul class="return">
|
2818
|
+
|
2819
|
+
<li>
|
2820
|
+
|
2821
|
+
|
2822
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
2823
|
+
|
2824
|
+
|
2825
|
+
|
2826
|
+
</li>
|
2827
|
+
|
2828
|
+
</ul>
|
2829
|
+
|
2830
|
+
</div><table class="source_code">
|
2831
|
+
<tr>
|
2832
|
+
<td>
|
2833
|
+
<pre class="lines">
|
2834
|
+
|
2835
|
+
|
2836
|
+
325
|
2837
|
+
326
|
2838
|
+
327</pre>
|
2839
|
+
</td>
|
2840
|
+
<td>
|
2841
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 325</span>
|
2842
|
+
|
2843
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_token_expired?'>token_expired?</span>
|
2844
|
+
<span class='ivar'>@token_expires_at</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>>=</span> <span class='ivar'>@token_expires_at</span>
|
2845
|
+
<span class='kw'>end</span></pre>
|
2846
|
+
</td>
|
2847
|
+
</tr>
|
2848
|
+
</table>
|
2849
|
+
</div>
|
2850
|
+
|
2851
|
+
<div class="method_details ">
|
2852
|
+
<h3 class="signature " id="with_debug-instance_method">
|
2853
|
+
|
2854
|
+
#<strong>with_debug</strong>(sql, &block) ⇒ <tt>Object</tt>
|
2855
|
+
|
2856
|
+
|
2857
|
+
|
2858
|
+
|
2859
|
+
|
2860
|
+
</h3><div class="docstring">
|
2861
|
+
<div class="discussion">
|
2862
|
+
<p>Wraps an SQL execution with debug logging.
|
2863
|
+
It sill include execution time.</p>
|
2864
|
+
|
2865
|
+
|
2866
|
+
</div>
|
2867
|
+
</div>
|
2868
|
+
<div class="tags">
|
2869
|
+
<p class="tag_title">Parameters:</p>
|
2870
|
+
<ul class="param">
|
2871
|
+
|
2872
|
+
<li>
|
2873
|
+
|
2874
|
+
<span class='name'>sql</span>
|
2875
|
+
|
2876
|
+
|
2877
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2878
|
+
|
2879
|
+
|
2880
|
+
|
2881
|
+
—
|
2882
|
+
<div class='inline'><p>actual sql being executed</p>
|
2883
|
+
</div>
|
2884
|
+
|
2885
|
+
</li>
|
2886
|
+
|
2887
|
+
</ul>
|
2888
|
+
|
2889
|
+
<p class="tag_title">Returns:</p>
|
2890
|
+
<ul class="return">
|
2891
|
+
|
2892
|
+
<li>
|
2893
|
+
|
2894
|
+
|
2895
|
+
<span class='type'></span>
|
2896
|
+
|
2897
|
+
|
2898
|
+
|
2899
|
+
|
2900
|
+
<div class='inline'><p>execution results (see #execute)</p>
|
2901
|
+
</div>
|
2902
|
+
|
2903
|
+
</li>
|
2904
|
+
|
2905
|
+
</ul>
|
2906
|
+
|
2907
|
+
</div><table class="source_code">
|
2908
|
+
<tr>
|
2909
|
+
<td>
|
2910
|
+
<pre class="lines">
|
2911
|
+
|
2912
|
+
|
2913
|
+
286
|
2914
|
+
287
|
2915
|
+
288
|
2916
|
+
289
|
2917
|
+
290
|
2918
|
+
291
|
2919
|
+
292
|
2920
|
+
293
|
2921
|
+
294
|
2922
|
+
295
|
2923
|
+
296
|
2924
|
+
297
|
2925
|
+
298</pre>
|
2926
|
+
</td>
|
2927
|
+
<td>
|
2928
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 286</span>
|
2929
|
+
|
2930
|
+
<span class='kw'>def</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='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2931
|
+
<span class='id identifier rubyid_starting'>starting</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_clock_gettime'>clock_gettime</span><span class='lparen'>(</span><span class='const'>Process</span><span class='op'>::</span><span class='const'>CLOCK_MONOTONIC</span><span class='rparen'>)</span>
|
2932
|
+
|
2933
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>=== SQL === \n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sql'>sql</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2934
|
+
|
2935
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
|
2936
|
+
|
2937
|
+
<span class='id identifier rubyid_ending'>ending</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_clock_gettime'>clock_gettime</span><span class='lparen'>(</span><span class='const'>Process</span><span class='op'>::</span><span class='const'>CLOCK_MONOTONIC</span><span class='rparen'>)</span>
|
2938
|
+
<span class='id identifier rubyid_elapsed'>elapsed</span> <span class='op'>=</span> <span class='id identifier rubyid_ending'>ending</span> <span class='op'>-</span> <span class='id identifier rubyid_starting'>starting</span>
|
2939
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>=== FINISHED SQL (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_elapsed'>elapsed</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'> secs) ===</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2940
|
+
|
2941
|
+
<span class='id identifier rubyid_result'>result</span>
|
2942
|
+
<span class='kw'>end</span></pre>
|
2943
|
+
</td>
|
2944
|
+
</tr>
|
2945
|
+
</table>
|
2946
|
+
</div>
|
2947
|
+
|
2948
|
+
<div class="method_details ">
|
2949
|
+
<h3 class="signature " id="with_retry-instance_method">
|
2950
|
+
|
2951
|
+
#<strong>with_retry</strong>(max_attempts = 2, &block) ⇒ <tt>Object</tt>
|
2952
|
+
|
2953
|
+
|
2954
|
+
|
2955
|
+
|
2956
|
+
|
2957
|
+
</h3><div class="docstring">
|
2958
|
+
<div class="discussion">
|
2959
|
+
<p>Will call the block with retries given by the
|
2960
|
+
max attempts param. If max attempts is 0, it
|
2961
|
+
will just return the block.call</p>
|
2962
|
+
|
2963
|
+
|
2964
|
+
</div>
|
2965
|
+
</div>
|
2966
|
+
<div class="tags">
|
2967
|
+
<p class="tag_title">Parameters:</p>
|
2968
|
+
<ul class="param">
|
2969
|
+
|
2970
|
+
<li>
|
2971
|
+
|
2972
|
+
<span class='name'>max_attempts</span>
|
2973
|
+
|
2974
|
+
|
2975
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
2976
|
+
|
2977
|
+
|
2978
|
+
<em class="default">(defaults to: <tt>2</tt>)</em>
|
2979
|
+
|
2980
|
+
|
2981
|
+
—
|
2982
|
+
<div class='inline'><p>max number of retries</p>
|
2983
|
+
</div>
|
2984
|
+
|
2985
|
+
</li>
|
2986
|
+
|
2987
|
+
</ul>
|
2988
|
+
|
2989
|
+
|
2990
|
+
</div><table class="source_code">
|
2991
|
+
<tr>
|
2992
|
+
<td>
|
2993
|
+
<pre class="lines">
|
2994
|
+
|
2995
|
+
|
2996
|
+
262
|
2997
|
+
263
|
2998
|
+
264
|
2999
|
+
265
|
3000
|
+
266
|
3001
|
+
267
|
3002
|
+
268
|
3003
|
+
269
|
3004
|
+
270
|
3005
|
+
271
|
3006
|
+
272
|
3007
|
+
273
|
3008
|
+
274
|
3009
|
+
275
|
3010
|
+
276
|
3011
|
+
277
|
3012
|
+
278
|
3013
|
+
279</pre>
|
3014
|
+
</td>
|
3015
|
+
<td>
|
3016
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters.rb', line 262</span>
|
3017
|
+
|
3018
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_with_retry'>with_retry</span><span class='lparen'>(</span><span class='id identifier rubyid_max_attempts'>max_attempts</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
3019
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='kw'>if</span> <span class='id identifier rubyid_max_attempts'>max_attempts</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
|
3020
|
+
|
3021
|
+
<span class='id identifier rubyid_attempts'>attempts</span> <span class='op'>=</span> <span class='int'>0</span>
|
3022
|
+
|
3023
|
+
<span class='kw'>begin</span>
|
3024
|
+
<span class='id identifier rubyid_attempts'>attempts</span> <span class='op'>+=</span> <span class='int'>1</span>
|
3025
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
|
3026
|
+
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
3027
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_attempts'>attempts</span> <span class='op'><</span> <span class='id identifier rubyid_max_attempts'>max_attempts</span>
|
3028
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Attempt </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attempts'>attempts</span><span class='embexpr_end'>}</span><span class='tstring_content'> failed with error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_content'>. Retrying...</span><span class='tstring_end'>"</span></span>
|
3029
|
+
<span class='kw'>retry</span>
|
3030
|
+
<span class='kw'>else</span>
|
3031
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Failed after </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attempts'>attempts</span><span class='embexpr_end'>}</span><span class='tstring_content'> attempts with error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
3032
|
+
<span class='id identifier rubyid_raise'>raise</span>
|
3033
|
+
<span class='kw'>end</span>
|
3034
|
+
<span class='kw'>end</span>
|
3035
|
+
<span class='kw'>end</span></pre>
|
3036
|
+
</td>
|
3037
|
+
</tr>
|
3038
|
+
</table>
|
3039
|
+
</div>
|
3040
|
+
|
3041
|
+
</div>
|
3042
|
+
|
3043
|
+
</div>
|
3044
|
+
|
3045
|
+
<div id="footer">
|
3046
|
+
Generated on Fri Aug 22 08:31:22 2025 by
|
3047
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
3048
|
+
0.9.37 (ruby-3.4.4).
|
3049
|
+
</div>
|
3050
|
+
|
3051
|
+
</div>
|
3052
|
+
</body>
|
3053
|
+
</html>
|