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,2012 @@
|
|
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::DuckDb
|
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::DuckDb";
|
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 (D)</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">DuckDb</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::DuckDb
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="Adapter.html" title="DWH::Adapters::Adapter (class)">Adapter</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="Adapter.html" title="DWH::Adapters::Adapter (class)">Adapter</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">DWH::Adapters::DuckDb</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/dwh/adapters/duck_db.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
<p>DuckDb adapter.</p>
|
107
|
+
|
108
|
+
<p>This requires the ruby <a href="https://github.com/suketa/ruby-duckdb" target="_parent" title="DuckDb">DuckDb</a> gem. Installation
|
109
|
+
is a bit complex. Please follow the guide on the gems page to make sure
|
110
|
+
you have DuckDb installed as required before installing the gem.</p>
|
111
|
+
|
112
|
+
<p>Generally, adapters should be created using <span class='object_link'><a href="../Factory.html#create-instance_method" title="DWH::Factory#create (method)">DWH.create</a></span>. Where a configuration
|
113
|
+
is passed in as options hash or argument list.</p>
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
<div class="tags">
|
119
|
+
|
120
|
+
<div class="examples">
|
121
|
+
<h4 class="tag_title">Examples:</h4>
|
122
|
+
|
123
|
+
|
124
|
+
<h5 class="example_title"><div class='inline'><p>Basic connection with required only options</p>
|
125
|
+
</div></h5>
|
126
|
+
|
127
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../../DWH.html" title="DWH (module)">DWH</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create'><span class='object_link'><a href="../Factory.html#create-instance_method" title="DWH::Factory#create (method)">create</a></span></span><span class='lparen'>(</span><span class='symbol'>:duckdb</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>file:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>path/to/my/duckdb</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span><span class='rparen'>)</span></code></pre>
|
128
|
+
|
129
|
+
|
130
|
+
<h5 class="example_title"><div class='inline'><p>Open in read only mode. <a href="https://duckdb.org/docs/stable/configuration/overview#configuration-reference" target="_parent" title="config docs">config docs</a></p>
|
131
|
+
</div></h5>
|
132
|
+
|
133
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../../DWH.html" title="DWH (module)">DWH</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create'><span class='object_link'><a href="../Factory.html#create-instance_method" title="DWH::Factory#create (method)">create</a></span></span><span class='lparen'>(</span><span class='symbol'>:duckdb</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>file:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>path/to/my/duckdb</span><span class='tstring_end'>'</span></span> <span class='comma'>,</span><span class='label'>duck_config:</span> <span class='lbrace'>{</span> <span class='label'>access_mode:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>READ_ONLY</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='rparen'>)</span></code></pre>
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
<h2>Constant Summary</h2>
|
142
|
+
|
143
|
+
<h3 class="inherited">Constants included
|
144
|
+
from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
145
|
+
<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>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<h3 class="inherited">Constants included
|
150
|
+
from <span class='object_link'><a href="../Functions/Dates.html" title="DWH::Functions::Dates (module)">Functions::Dates</a></span></h3>
|
151
|
+
<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>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<h2>Instance Attribute Summary</h2>
|
157
|
+
|
158
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Adapter.html" title="DWH::Adapters::Adapter (class)">Adapter</a></span></h3>
|
159
|
+
<p class="inherited"><span class='object_link'><a href="Adapter.html#config-instance_method" title="DWH::Adapters::Adapter#config (method)">#config</a></span>, <span class='object_link'><a href="Adapter.html#settings-instance_method" title="DWH::Adapters::Adapter#settings (method)">#settings</a></span></p>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<h3 class="inherited">Attributes included from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
164
|
+
<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>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<h2>
|
169
|
+
Class Method Summary
|
170
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
171
|
+
</h2>
|
172
|
+
|
173
|
+
<ul class="summary">
|
174
|
+
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
177
|
+
|
178
|
+
<a href="#close_all-class_method" title="close_all (class method)">.<strong>close_all</strong> ⇒ Object </a>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<span class="summary_desc"><div class='inline'><p>DuckDB is an in process database so we don’t want to open multiple instances of the same db in memory.</p>
|
193
|
+
</div></span>
|
194
|
+
|
195
|
+
</li>
|
196
|
+
|
197
|
+
|
198
|
+
<li class="public ">
|
199
|
+
<span class="summary_signature">
|
200
|
+
|
201
|
+
<a href="#databases-class_method" title="databases (class method)">.<strong>databases</strong> ⇒ Object </a>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</span>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
<li class="public ">
|
222
|
+
<span class="summary_signature">
|
223
|
+
|
224
|
+
<a href="#open_databases-class_method" title="open_databases (class method)">.<strong>open_databases</strong> ⇒ Object </a>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
<span class="summary_desc"><div class='inline'>
|
239
|
+
</div></span>
|
240
|
+
|
241
|
+
</li>
|
242
|
+
|
243
|
+
|
244
|
+
</ul>
|
245
|
+
|
246
|
+
<h2>
|
247
|
+
Instance Method Summary
|
248
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
249
|
+
</h2>
|
250
|
+
|
251
|
+
<ul class="summary">
|
252
|
+
|
253
|
+
<li class="public ">
|
254
|
+
<span class="summary_signature">
|
255
|
+
|
256
|
+
<a href="#close-instance_method" title="#close (instance method)">#<strong>close</strong> ⇒ Object </a>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
</span>
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
<span class="summary_desc"><div class='inline'><p>This disconnects the current connection but the db is still in process and can be reconnected to.</p>
|
271
|
+
</div></span>
|
272
|
+
|
273
|
+
</li>
|
274
|
+
|
275
|
+
|
276
|
+
<li class="public ">
|
277
|
+
<span class="summary_signature">
|
278
|
+
|
279
|
+
<a href="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong> ⇒ Object </a>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
</span>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
<span class="summary_desc"><div class='inline'><p>Creates a connection to the target database and returns the connection object or self.</p>
|
294
|
+
</div></span>
|
295
|
+
|
296
|
+
</li>
|
297
|
+
|
298
|
+
|
299
|
+
<li class="public ">
|
300
|
+
<span class="summary_signature">
|
301
|
+
|
302
|
+
<a href="#execute-instance_method" title="#execute (instance method)">#<strong>execute</strong>(sql, format: :array, retries: 0) ⇒ Array<Array>, ... </a>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
</span>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
<span class="summary_desc"><div class='inline'><p>Execute sql on the target database.</p>
|
317
|
+
</div></span>
|
318
|
+
|
319
|
+
</li>
|
320
|
+
|
321
|
+
|
322
|
+
<li class="public ">
|
323
|
+
<span class="summary_signature">
|
324
|
+
|
325
|
+
<a href="#execute_stream-instance_method" title="#execute_stream (instance method)">#<strong>execute_stream</strong>(sql, io, stats: nil, retries: 0) ⇒ IO </a>
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
</span>
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
<span class="summary_desc"><div class='inline'><p>Execute sql and stream responses back.</p>
|
340
|
+
</div></span>
|
341
|
+
|
342
|
+
</li>
|
343
|
+
|
344
|
+
|
345
|
+
<li class="public ">
|
346
|
+
<span class="summary_signature">
|
347
|
+
|
348
|
+
<a href="#metadata-instance_method" title="#metadata (instance method)">#<strong>metadata</strong>(table, **qualifiers) ⇒ DWH::Table </a>
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
</span>
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
<span class="summary_desc"><div class='inline'><p>Get the schema structure of a given a given table_name.</p>
|
363
|
+
</div></span>
|
364
|
+
|
365
|
+
</li>
|
366
|
+
|
367
|
+
|
368
|
+
<li class="public ">
|
369
|
+
<span class="summary_signature">
|
370
|
+
|
371
|
+
<a href="#schema%3F-instance_method" title="#schema? (instance method)">#<strong>schema?</strong> ⇒ Boolean </a>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
</span>
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
<span class="summary_desc"><div class='inline'><p>True if the configuration was setup with a schema.</p>
|
386
|
+
</div></span>
|
387
|
+
|
388
|
+
</li>
|
389
|
+
|
390
|
+
|
391
|
+
<li class="public ">
|
392
|
+
<span class="summary_signature">
|
393
|
+
|
394
|
+
<a href="#stats-instance_method" title="#stats (instance method)">#<strong>stats</strong>(table, date_column: nil, **qualifiers) ⇒ DWH::Table </a>
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
</span>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
<span class="summary_desc"><div class='inline'><p>Returns basic stats of a given table.</p>
|
409
|
+
</div></span>
|
410
|
+
|
411
|
+
</li>
|
412
|
+
|
413
|
+
|
414
|
+
<li class="public ">
|
415
|
+
<span class="summary_signature">
|
416
|
+
|
417
|
+
<a href="#stream-instance_method" title="#stream (instance method)">#<strong>stream</strong>(sql) {|chunk| ... } ⇒ Object </a>
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
</span>
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
<span class="summary_desc"><div class='inline'><p>Executes the given sql and yields the streamed results to the given block.</p>
|
432
|
+
</div></span>
|
433
|
+
|
434
|
+
</li>
|
435
|
+
|
436
|
+
|
437
|
+
<li class="public ">
|
438
|
+
<span class="summary_signature">
|
439
|
+
|
440
|
+
<a href="#tables-instance_method" title="#tables (instance method)">#<strong>tables</strong>(**qualifiers) ⇒ Array<String> </a>
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
</span>
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
<span class="summary_desc"><div class='inline'><p>Get all tables available in the target db.</p>
|
455
|
+
</div></span>
|
456
|
+
|
457
|
+
</li>
|
458
|
+
|
459
|
+
|
460
|
+
<li class="public ">
|
461
|
+
<span class="summary_signature">
|
462
|
+
|
463
|
+
<a href="#test_connection-instance_method" title="#test_connection (instance method)">#<strong>test_connection</strong>(raise_exception: false) ⇒ Boolean </a>
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
</span>
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
<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>
|
478
|
+
</div></span>
|
479
|
+
|
480
|
+
</li>
|
481
|
+
|
482
|
+
|
483
|
+
<li class="public ">
|
484
|
+
<span class="summary_signature">
|
485
|
+
|
486
|
+
<a href="#valid_config%3F-instance_method" title="#valid_config? (instance method)">#<strong>valid_config?</strong> ⇒ Boolean </a>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
</span>
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
<span class="summary_desc"><div class='inline'>
|
501
|
+
</div></span>
|
502
|
+
|
503
|
+
</li>
|
504
|
+
|
505
|
+
|
506
|
+
</ul>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Adapter.html" title="DWH::Adapters::Adapter (class)">Adapter</a></span></h3>
|
519
|
+
<p class="inherited"><span class='object_link'><a href="Adapter.html#adapter_name-instance_method" title="DWH::Adapters::Adapter#adapter_name (method)">#adapter_name</a></span>, <span class='object_link'><a href="Adapter.html#alter_settings-instance_method" title="DWH::Adapters::Adapter#alter_settings (method)">#alter_settings</a></span>, <span class='object_link'><a href="Adapter.html#config-class_method" title="DWH::Adapters::Adapter.config (method)">config</a></span>, <span class='object_link'><a href="Adapter.html#configuration-class_method" title="DWH::Adapters::Adapter.configuration (method)">configuration</a></span>, <span class='object_link'><a href="Adapter.html#connect!-instance_method" title="DWH::Adapters::Adapter#connect! (method)">#connect!</a></span>, <span class='object_link'><a href="Adapter.html#connect%3F-instance_method" title="DWH::Adapters::Adapter#connect? (method)">#connect?</a></span>, <span class='object_link'><a href="Adapter.html#extra_connection_params-instance_method" title="DWH::Adapters::Adapter#extra_connection_params (method)">#extra_connection_params</a></span>, <span class='object_link'><a href="Adapter.html#extra_query_params-instance_method" title="DWH::Adapters::Adapter#extra_query_params (method)">#extra_query_params</a></span>, <span class='object_link'><a href="Adapter.html#initialize-instance_method" title="DWH::Adapters::Adapter#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Adapter.html#reset_settings-instance_method" title="DWH::Adapters::Adapter#reset_settings (method)">#reset_settings</a></span>, <span class='object_link'><a href="Adapter.html#table%3F-instance_method" title="DWH::Adapters::Adapter#table? (method)">#table?</a></span>, <span class='object_link'><a href="Adapter.html#token_expired%3F-instance_method" title="DWH::Adapters::Adapter#token_expired? (method)">#token_expired?</a></span>, <span class='object_link'><a href="Adapter.html#with_debug-instance_method" title="DWH::Adapters::Adapter#with_debug (method)">#with_debug</a></span>, <span class='object_link'><a href="Adapter.html#with_retry-instance_method" title="DWH::Adapters::Adapter#with_retry (method)">#with_retry</a></span></p>
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Settings.html" title="DWH::Settings (module)">Settings</a></span></h3>
|
530
|
+
<p class="inherited"><span class='object_link'><a href="../Settings.html#adapter_name-instance_method" title="DWH::Settings#adapter_name (method)">#adapter_name</a></span>, <span class='object_link'><a href="../Settings.html#load_settings-instance_method" title="DWH::Settings#load_settings (method)">#load_settings</a></span>, <span class='object_link'><a href="../Settings.html#settings_file-instance_method" title="DWH::Settings#settings_file (method)">#settings_file</a></span>, <span class='object_link'><a href="../Settings.html#settings_file_path-instance_method" title="DWH::Settings#settings_file_path (method)">#settings_file_path</a></span>, <span class='object_link'><a href="../Settings.html#using_base_settings%3F-instance_method" title="DWH::Settings#using_base_settings? (method)">#using_base_settings?</a></span></p>
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Logger.html" title="DWH::Logger (module)">Logger</a></span></h3>
|
541
|
+
<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>
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Behaviors.html" title="DWH::Behaviors (module)">Behaviors</a></span></h3>
|
552
|
+
<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>
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Functions.html" title="DWH::Functions (module)">Functions</a></span></h3>
|
563
|
+
<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>
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
<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>
|
574
|
+
<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>
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
<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>
|
585
|
+
<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>
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
<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>
|
596
|
+
<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>
|
597
|
+
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
<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>
|
607
|
+
<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>
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Capabilities.html" title="DWH::Capabilities (module)">Capabilities</a></span></h3>
|
618
|
+
<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>
|
619
|
+
<div id="constructor_details" class="method_details_list">
|
620
|
+
<h2>Constructor Details</h2>
|
621
|
+
|
622
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Adapter.html#initialize-instance_method" title="DWH::Adapters::Adapter#initialize (method)">DWH::Adapters::Adapter</a></span></p>
|
623
|
+
|
624
|
+
</div>
|
625
|
+
|
626
|
+
|
627
|
+
<div id="class_method_details" class="method_details_list">
|
628
|
+
<h2>Class Method Details</h2>
|
629
|
+
|
630
|
+
|
631
|
+
<div class="method_details first">
|
632
|
+
<h3 class="signature first" id="close_all-class_method">
|
633
|
+
|
634
|
+
.<strong>close_all</strong> ⇒ <tt>Object</tt>
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
|
640
|
+
</h3><div class="docstring">
|
641
|
+
<div class="discussion">
|
642
|
+
<p>DuckDB is an in process database so we don’t want to
|
643
|
+
open multiple instances of the same db in memory. Rather,
|
644
|
+
we open one instance but many connections. Use this
|
645
|
+
method to close them all.</p>
|
646
|
+
|
647
|
+
|
648
|
+
</div>
|
649
|
+
</div>
|
650
|
+
<div class="tags">
|
651
|
+
|
652
|
+
|
653
|
+
</div><table class="source_code">
|
654
|
+
<tr>
|
655
|
+
<td>
|
656
|
+
<pre class="lines">
|
657
|
+
|
658
|
+
|
659
|
+
58
|
660
|
+
59
|
661
|
+
60
|
662
|
+
61
|
663
|
+
62
|
664
|
+
63</pre>
|
665
|
+
</td>
|
666
|
+
<td>
|
667
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 58</span>
|
668
|
+
|
669
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_close_all'>close_all</span>
|
670
|
+
<span class='id identifier rubyid_databases'>databases</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_db'>db</span><span class='op'>|</span>
|
671
|
+
<span class='id identifier rubyid_db'>db</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
672
|
+
<span class='id identifier rubyid_databases'>databases</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
673
|
+
<span class='kw'>end</span>
|
674
|
+
<span class='kw'>end</span></pre>
|
675
|
+
</td>
|
676
|
+
</tr>
|
677
|
+
</table>
|
678
|
+
</div>
|
679
|
+
|
680
|
+
<div class="method_details ">
|
681
|
+
<h3 class="signature " id="databases-class_method">
|
682
|
+
|
683
|
+
.<strong>databases</strong> ⇒ <tt>Object</tt>
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
|
689
|
+
</h3><table class="source_code">
|
690
|
+
<tr>
|
691
|
+
<td>
|
692
|
+
<pre class="lines">
|
693
|
+
|
694
|
+
|
695
|
+
46
|
696
|
+
47
|
697
|
+
48</pre>
|
698
|
+
</td>
|
699
|
+
<td>
|
700
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 46</span>
|
701
|
+
|
702
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_databases'>databases</span>
|
703
|
+
<span class='ivar'>@databases</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
704
|
+
<span class='kw'>end</span></pre>
|
705
|
+
</td>
|
706
|
+
</tr>
|
707
|
+
</table>
|
708
|
+
</div>
|
709
|
+
|
710
|
+
<div class="method_details ">
|
711
|
+
<h3 class="signature " id="open_databases-class_method">
|
712
|
+
|
713
|
+
.<strong>open_databases</strong> ⇒ <tt>Object</tt>
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
</h3><table class="source_code">
|
720
|
+
<tr>
|
721
|
+
<td>
|
722
|
+
<pre class="lines">
|
723
|
+
|
724
|
+
|
725
|
+
50
|
726
|
+
51
|
727
|
+
52</pre>
|
728
|
+
</td>
|
729
|
+
<td>
|
730
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 50</span>
|
731
|
+
|
732
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_open_databases'>open_databases</span>
|
733
|
+
<span class='id identifier rubyid_databases'>databases</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
|
734
|
+
<span class='kw'>end</span></pre>
|
735
|
+
</td>
|
736
|
+
</tr>
|
737
|
+
</table>
|
738
|
+
</div>
|
739
|
+
|
740
|
+
</div>
|
741
|
+
|
742
|
+
<div id="instance_method_details" class="method_details_list">
|
743
|
+
<h2>Instance Method Details</h2>
|
744
|
+
|
745
|
+
|
746
|
+
<div class="method_details first">
|
747
|
+
<h3 class="signature first" id="close-instance_method">
|
748
|
+
|
749
|
+
#<strong>close</strong> ⇒ <tt>Object</tt>
|
750
|
+
|
751
|
+
|
752
|
+
|
753
|
+
|
754
|
+
|
755
|
+
</h3><div class="docstring">
|
756
|
+
<div class="discussion">
|
757
|
+
<p>This disconnects the current connection but
|
758
|
+
the db is still in process and can be reconnected
|
759
|
+
to.</p>
|
760
|
+
|
761
|
+
<p>(see Adapter#close)</p>
|
762
|
+
|
763
|
+
|
764
|
+
</div>
|
765
|
+
</div>
|
766
|
+
<div class="tags">
|
767
|
+
|
768
|
+
|
769
|
+
</div><table class="source_code">
|
770
|
+
<tr>
|
771
|
+
<td>
|
772
|
+
<pre class="lines">
|
773
|
+
|
774
|
+
|
775
|
+
70
|
776
|
+
71
|
777
|
+
72
|
778
|
+
73</pre>
|
779
|
+
</td>
|
780
|
+
<td>
|
781
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 70</span>
|
782
|
+
|
783
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
|
784
|
+
<span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_disconnect'>disconnect</span>
|
785
|
+
<span class='ivar'>@connection</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
786
|
+
<span class='kw'>end</span></pre>
|
787
|
+
</td>
|
788
|
+
</tr>
|
789
|
+
</table>
|
790
|
+
</div>
|
791
|
+
|
792
|
+
<div class="method_details ">
|
793
|
+
<h3 class="signature " id="connection-instance_method">
|
794
|
+
|
795
|
+
#<strong>connection</strong> ⇒ <tt>Object</tt>
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
</h3><div class="docstring">
|
802
|
+
<div class="discussion">
|
803
|
+
<p>Creates a connection to the target database and returns the
|
804
|
+
connection object or self</p>
|
805
|
+
|
806
|
+
|
807
|
+
</div>
|
808
|
+
</div>
|
809
|
+
<div class="tags">
|
810
|
+
|
811
|
+
|
812
|
+
</div><table class="source_code">
|
813
|
+
<tr>
|
814
|
+
<td>
|
815
|
+
<pre class="lines">
|
816
|
+
|
817
|
+
|
818
|
+
23
|
819
|
+
24
|
820
|
+
25
|
821
|
+
26
|
822
|
+
27
|
823
|
+
28
|
824
|
+
29
|
825
|
+
30
|
826
|
+
31
|
827
|
+
32
|
828
|
+
33
|
829
|
+
34
|
830
|
+
35
|
831
|
+
36
|
832
|
+
37
|
833
|
+
38
|
834
|
+
39
|
835
|
+
40
|
836
|
+
41
|
837
|
+
42
|
838
|
+
43
|
839
|
+
44</pre>
|
840
|
+
</td>
|
841
|
+
<td>
|
842
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 23</span>
|
843
|
+
|
844
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
|
845
|
+
<span class='kw'>return</span> <span class='ivar'>@connection</span> <span class='kw'>if</span> <span class='ivar'>@connection</span>
|
846
|
+
|
847
|
+
<span class='kw'>if</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_databases'>databases</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:file</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
848
|
+
<span class='ivar'>@db</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_databases'>databases</span><span class='lbracket'>[</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:file</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
849
|
+
<span class='kw'>else</span>
|
850
|
+
<span class='id identifier rubyid_ducked_config'>ducked_config</span> <span class='op'>=</span> <span class='const'>DuckDB</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
851
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='symbol'>:duck_config</span><span class='rparen'>)</span>
|
852
|
+
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:duck_config</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span><span class='op'>|</span>
|
853
|
+
<span class='id identifier rubyid_ducked_config'>ducked_config</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_val'>val</span>
|
854
|
+
<span class='kw'>end</span>
|
855
|
+
<span class='kw'>end</span>
|
856
|
+
<span class='ivar'>@db</span> <span class='op'>=</span> <span class='const'>DuckDB</span><span class='op'>::</span><span class='const'>Database</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:file</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_ducked_config'>ducked_config</span><span class='rparen'>)</span>
|
857
|
+
<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_databases'>databases</span><span class='lbracket'>[</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:file</span><span class='rbracket'>]</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='ivar'>@db</span>
|
858
|
+
<span class='kw'>end</span>
|
859
|
+
|
860
|
+
<span class='ivar'>@connection</span> <span class='op'>=</span> <span class='ivar'>@db</span><span class='period'>.</span><span class='id identifier rubyid_connect'>connect</span>
|
861
|
+
|
862
|
+
<span class='ivar'>@connection</span>
|
863
|
+
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
864
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ConfigError.html" title="DWH::ConfigError (class)">ConfigError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
865
|
+
<span class='kw'>end</span></pre>
|
866
|
+
</td>
|
867
|
+
</tr>
|
868
|
+
</table>
|
869
|
+
</div>
|
870
|
+
|
871
|
+
<div class="method_details ">
|
872
|
+
<h3 class="signature " id="execute-instance_method">
|
873
|
+
|
874
|
+
#<strong>execute</strong>(sql, format: :array, retries: 0) ⇒ <tt>Array<Array></tt>, ...
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
|
880
|
+
</h3><div class="docstring">
|
881
|
+
<div class="discussion">
|
882
|
+
<p>Execute sql on the target database.</p>
|
883
|
+
|
884
|
+
|
885
|
+
</div>
|
886
|
+
</div>
|
887
|
+
<div class="tags">
|
888
|
+
<p class="tag_title">Parameters:</p>
|
889
|
+
<ul class="param">
|
890
|
+
|
891
|
+
<li>
|
892
|
+
|
893
|
+
<span class='name'>sql</span>
|
894
|
+
|
895
|
+
|
896
|
+
<span class='type'>(<tt>String</tt>)</span>
|
897
|
+
|
898
|
+
|
899
|
+
|
900
|
+
—
|
901
|
+
<div class='inline'><p>actual sql</p>
|
902
|
+
</div>
|
903
|
+
|
904
|
+
</li>
|
905
|
+
|
906
|
+
<li>
|
907
|
+
|
908
|
+
<span class='name'>format</span>
|
909
|
+
|
910
|
+
|
911
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
|
912
|
+
|
913
|
+
|
914
|
+
<em class="default">(defaults to: <tt>:array</tt>)</em>
|
915
|
+
|
916
|
+
|
917
|
+
—
|
918
|
+
<div class='inline'><p>return format type
|
919
|
+
- array returns array of array
|
920
|
+
- object returns array of Hashes
|
921
|
+
- csv returns as csv
|
922
|
+
- native returns the native result from any clients used
|
923
|
+
- For example: Postgres using pg client will return PG::Result
|
924
|
+
- Http clients will returns the HTTP response object</p>
|
925
|
+
</div>
|
926
|
+
|
927
|
+
</li>
|
928
|
+
|
929
|
+
<li>
|
930
|
+
|
931
|
+
<span class='name'>retries</span>
|
932
|
+
|
933
|
+
|
934
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
935
|
+
|
936
|
+
|
937
|
+
<em class="default">(defaults to: <tt>0</tt>)</em>
|
938
|
+
|
939
|
+
|
940
|
+
—
|
941
|
+
<div class='inline'><p>number of retries in case of failure. Default is 0</p>
|
942
|
+
</div>
|
943
|
+
|
944
|
+
</li>
|
945
|
+
|
946
|
+
</ul>
|
947
|
+
|
948
|
+
<p class="tag_title">Returns:</p>
|
949
|
+
<ul class="return">
|
950
|
+
|
951
|
+
<li>
|
952
|
+
|
953
|
+
|
954
|
+
<span class='type'>(<tt>Array<Array></tt>, <tt>Hash</tt>, <tt>CSV</tt>, <tt>Native</tt>)</span>
|
955
|
+
|
956
|
+
|
957
|
+
|
958
|
+
</li>
|
959
|
+
|
960
|
+
</ul>
|
961
|
+
<p class="tag_title">Raises:</p>
|
962
|
+
<ul class="raise">
|
963
|
+
|
964
|
+
<li>
|
965
|
+
|
966
|
+
|
967
|
+
<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>
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
</li>
|
972
|
+
|
973
|
+
</ul>
|
974
|
+
|
975
|
+
</div><table class="source_code">
|
976
|
+
<tr>
|
977
|
+
<td>
|
978
|
+
<pre class="lines">
|
979
|
+
|
980
|
+
|
981
|
+
157
|
982
|
+
158
|
983
|
+
159
|
984
|
+
160
|
985
|
+
161
|
986
|
+
162
|
987
|
+
163
|
988
|
+
164
|
989
|
+
165
|
990
|
+
166
|
991
|
+
167
|
992
|
+
168
|
993
|
+
169
|
994
|
+
170
|
995
|
+
171
|
996
|
+
172
|
997
|
+
173
|
998
|
+
174
|
999
|
+
175
|
1000
|
+
176
|
1001
|
+
177</pre>
|
1002
|
+
</td>
|
1003
|
+
<td>
|
1004
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 157</span>
|
1005
|
+
|
1006
|
+
<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>
|
1007
|
+
<span class='kw'>begin</span>
|
1008
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_with_debug'>with_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_with_retry'>with_retry</span><span class='lparen'>(</span><span class='id identifier rubyid_retries'>retries</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
1009
|
+
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
1010
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ExecutionError.html" title="DWH::ExecutionError (class)">ExecutionError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
1011
|
+
<span class='kw'>end</span>
|
1012
|
+
|
1013
|
+
<span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
1014
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
1015
|
+
<span class='kw'>when</span> <span class='symbol'>:array</span>
|
1016
|
+
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span>
|
1017
|
+
<span class='kw'>when</span> <span class='symbol'>:object</span>
|
1018
|
+
<span class='id identifier rubyid_result_to_hash'>result_to_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
|
1019
|
+
<span class='kw'>when</span> <span class='symbol'>:csv</span>
|
1020
|
+
<span class='id identifier rubyid_result_to_csv'>result_to_csv</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
|
1021
|
+
<span class='kw'>when</span> <span class='symbol'>:native</span>
|
1022
|
+
<span class='id identifier rubyid_result'>result</span>
|
1023
|
+
<span class='kw'>else</span>
|
1024
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../UnsupportedCapability.html" title="DWH::UnsupportedCapability (class)">UnsupportedCapability</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unsupported format: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_content'> for this </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>
|
1025
|
+
<span class='kw'>end</span>
|
1026
|
+
<span class='kw'>end</span></pre>
|
1027
|
+
</td>
|
1028
|
+
</tr>
|
1029
|
+
</table>
|
1030
|
+
</div>
|
1031
|
+
|
1032
|
+
<div class="method_details ">
|
1033
|
+
<h3 class="signature " id="execute_stream-instance_method">
|
1034
|
+
|
1035
|
+
#<strong>execute_stream</strong>(sql, io, stats: nil, retries: 0) ⇒ <tt>IO</tt>
|
1036
|
+
|
1037
|
+
|
1038
|
+
|
1039
|
+
|
1040
|
+
|
1041
|
+
</h3><div class="docstring">
|
1042
|
+
<div class="discussion">
|
1043
|
+
<p>Execute sql and stream responses back. Data is writtent out in CSV format
|
1044
|
+
to the provided IO object.</p>
|
1045
|
+
|
1046
|
+
|
1047
|
+
</div>
|
1048
|
+
</div>
|
1049
|
+
<div class="tags">
|
1050
|
+
<p class="tag_title">Parameters:</p>
|
1051
|
+
<ul class="param">
|
1052
|
+
|
1053
|
+
<li>
|
1054
|
+
|
1055
|
+
<span class='name'>sql</span>
|
1056
|
+
|
1057
|
+
|
1058
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1059
|
+
|
1060
|
+
|
1061
|
+
|
1062
|
+
—
|
1063
|
+
<div class='inline'><p>actual sql</p>
|
1064
|
+
</div>
|
1065
|
+
|
1066
|
+
</li>
|
1067
|
+
|
1068
|
+
<li>
|
1069
|
+
|
1070
|
+
<span class='name'>io</span>
|
1071
|
+
|
1072
|
+
|
1073
|
+
<span class='type'>(<tt>IO</tt>)</span>
|
1074
|
+
|
1075
|
+
|
1076
|
+
|
1077
|
+
—
|
1078
|
+
<div class='inline'><p>IO object to write records to</p>
|
1079
|
+
</div>
|
1080
|
+
|
1081
|
+
</li>
|
1082
|
+
|
1083
|
+
<li>
|
1084
|
+
|
1085
|
+
<span class='name'>stats</span>
|
1086
|
+
|
1087
|
+
|
1088
|
+
<span class='type'>(<tt><span class='object_link'><a href="../StreamingStats.html" title="DWH::StreamingStats (class)">StreamingStats</a></span></tt>)</span>
|
1089
|
+
|
1090
|
+
|
1091
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1092
|
+
|
1093
|
+
|
1094
|
+
—
|
1095
|
+
<div class='inline'><p>collect stats and preview data this is optional</p>
|
1096
|
+
</div>
|
1097
|
+
|
1098
|
+
</li>
|
1099
|
+
|
1100
|
+
<li>
|
1101
|
+
|
1102
|
+
<span class='name'>retries</span>
|
1103
|
+
|
1104
|
+
|
1105
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
1106
|
+
|
1107
|
+
|
1108
|
+
<em class="default">(defaults to: <tt>0</tt>)</em>
|
1109
|
+
|
1110
|
+
|
1111
|
+
—
|
1112
|
+
<div class='inline'><p>number of retries in case of failure</p>
|
1113
|
+
</div>
|
1114
|
+
|
1115
|
+
</li>
|
1116
|
+
|
1117
|
+
</ul>
|
1118
|
+
|
1119
|
+
<p class="tag_title">Returns:</p>
|
1120
|
+
<ul class="return">
|
1121
|
+
|
1122
|
+
<li>
|
1123
|
+
|
1124
|
+
|
1125
|
+
<span class='type'>(<tt>IO</tt>)</span>
|
1126
|
+
|
1127
|
+
|
1128
|
+
|
1129
|
+
</li>
|
1130
|
+
|
1131
|
+
</ul>
|
1132
|
+
<p class="tag_title">Raises:</p>
|
1133
|
+
<ul class="raise">
|
1134
|
+
|
1135
|
+
<li>
|
1136
|
+
|
1137
|
+
|
1138
|
+
<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>
|
1139
|
+
|
1140
|
+
|
1141
|
+
|
1142
|
+
</li>
|
1143
|
+
|
1144
|
+
</ul>
|
1145
|
+
|
1146
|
+
</div><table class="source_code">
|
1147
|
+
<tr>
|
1148
|
+
<td>
|
1149
|
+
<pre class="lines">
|
1150
|
+
|
1151
|
+
|
1152
|
+
180
|
1153
|
+
181
|
1154
|
+
182
|
1155
|
+
183
|
1156
|
+
184
|
1157
|
+
185
|
1158
|
+
186
|
1159
|
+
187
|
1160
|
+
188
|
1161
|
+
189
|
1162
|
+
190
|
1163
|
+
191
|
1164
|
+
192
|
1165
|
+
193
|
1166
|
+
194
|
1167
|
+
195
|
1168
|
+
196</pre>
|
1169
|
+
</td>
|
1170
|
+
<td>
|
1171
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 180</span>
|
1172
|
+
|
1173
|
+
<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>
|
1174
|
+
<span class='id identifier rubyid_with_debug'>with_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1175
|
+
<span class='id identifier rubyid_with_retry'>with_retry</span><span class='lparen'>(</span><span class='id identifier rubyid_retries'>retries</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1176
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span>
|
1177
|
+
<span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='const'>CSV</span><span class='period'>.</span><span class='id identifier rubyid_generate_line'>generate_line</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1178
|
+
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
|
1179
|
+
<span class='id identifier rubyid_stats'>stats</span> <span class='op'><<</span> <span class='id identifier rubyid_row'>row</span> <span class='kw'>unless</span> <span class='id identifier rubyid_stats'>stats</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1180
|
+
<span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='const'>CSV</span><span class='period'>.</span><span class='id identifier rubyid_generate_line'>generate_line</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1181
|
+
<span class='kw'>end</span>
|
1182
|
+
<span class='kw'>end</span>
|
1183
|
+
<span class='kw'>end</span>
|
1184
|
+
|
1185
|
+
<span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_rewind'>rewind</span>
|
1186
|
+
<span class='id identifier rubyid_io'>io</span>
|
1187
|
+
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
1188
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ExecutionError.html" title="DWH::ExecutionError (class)">ExecutionError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
1189
|
+
<span class='kw'>end</span></pre>
|
1190
|
+
</td>
|
1191
|
+
</tr>
|
1192
|
+
</table>
|
1193
|
+
</div>
|
1194
|
+
|
1195
|
+
<div class="method_details ">
|
1196
|
+
<h3 class="signature " id="metadata-instance_method">
|
1197
|
+
|
1198
|
+
#<strong>metadata</strong>(table, **qualifiers) ⇒ <tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>
|
1199
|
+
|
1200
|
+
|
1201
|
+
|
1202
|
+
|
1203
|
+
|
1204
|
+
</h3><div class="docstring">
|
1205
|
+
<div class="discussion">
|
1206
|
+
<p>Get the schema structure of a given a given table_name.
|
1207
|
+
Pass in optional catalog and schema info.</p>
|
1208
|
+
|
1209
|
+
<p>Example:
|
1210
|
+
metadata(“public.big_table”)
|
1211
|
+
metadata(“big_table”)
|
1212
|
+
metadata(“big_table”,schema: “public”)</p>
|
1213
|
+
|
1214
|
+
|
1215
|
+
</div>
|
1216
|
+
</div>
|
1217
|
+
<div class="tags">
|
1218
|
+
<p class="tag_title">Parameters:</p>
|
1219
|
+
<ul class="param">
|
1220
|
+
|
1221
|
+
<li>
|
1222
|
+
|
1223
|
+
<span class='name'>table</span>
|
1224
|
+
|
1225
|
+
|
1226
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1227
|
+
|
1228
|
+
|
1229
|
+
|
1230
|
+
—
|
1231
|
+
<div class='inline'><ul>
|
1232
|
+
<li>table name</li>
|
1233
|
+
</ul>
|
1234
|
+
</div>
|
1235
|
+
|
1236
|
+
</li>
|
1237
|
+
|
1238
|
+
<li>
|
1239
|
+
|
1240
|
+
<span class='name'>qualifiers</span>
|
1241
|
+
|
1242
|
+
|
1243
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1244
|
+
|
1245
|
+
|
1246
|
+
|
1247
|
+
—
|
1248
|
+
<div class='inline'><p>a customizable set of options</p>
|
1249
|
+
</div>
|
1250
|
+
|
1251
|
+
</li>
|
1252
|
+
|
1253
|
+
</ul>
|
1254
|
+
|
1255
|
+
|
1256
|
+
|
1257
|
+
|
1258
|
+
|
1259
|
+
|
1260
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
1261
|
+
<ul class="option">
|
1262
|
+
|
1263
|
+
<li>
|
1264
|
+
<span class="name">:catalog</span>
|
1265
|
+
<span class="type">(<tt>String</tt>)</span>
|
1266
|
+
<span class="default">
|
1267
|
+
|
1268
|
+
</span>
|
1269
|
+
|
1270
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
1271
|
+
will be ignored if the adapter doesn’t support</p>
|
1272
|
+
</div>
|
1273
|
+
|
1274
|
+
</li>
|
1275
|
+
|
1276
|
+
<li>
|
1277
|
+
<span class="name">:schema</span>
|
1278
|
+
<span class="type">(<tt>String</tt>)</span>
|
1279
|
+
<span class="default">
|
1280
|
+
|
1281
|
+
</span>
|
1282
|
+
|
1283
|
+
— <div class='inline'><p>optional schema to scope to.
|
1284
|
+
will be ignored if the adapter doesn’t support</p>
|
1285
|
+
</div>
|
1286
|
+
|
1287
|
+
</li>
|
1288
|
+
|
1289
|
+
</ul>
|
1290
|
+
|
1291
|
+
|
1292
|
+
<p class="tag_title">Returns:</p>
|
1293
|
+
<ul class="return">
|
1294
|
+
|
1295
|
+
<li>
|
1296
|
+
|
1297
|
+
|
1298
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>)</span>
|
1299
|
+
|
1300
|
+
|
1301
|
+
|
1302
|
+
</li>
|
1303
|
+
|
1304
|
+
</ul>
|
1305
|
+
|
1306
|
+
</div><table class="source_code">
|
1307
|
+
<tr>
|
1308
|
+
<td>
|
1309
|
+
<pre class="lines">
|
1310
|
+
|
1311
|
+
|
1312
|
+
124
|
1313
|
+
125
|
1314
|
+
126
|
1315
|
+
127
|
1316
|
+
128
|
1317
|
+
129
|
1318
|
+
130
|
1319
|
+
131
|
1320
|
+
132
|
1321
|
+
133
|
1322
|
+
134
|
1323
|
+
135
|
1324
|
+
136
|
1325
|
+
137
|
1326
|
+
138
|
1327
|
+
139
|
1328
|
+
140
|
1329
|
+
141
|
1330
|
+
142
|
1331
|
+
143
|
1332
|
+
144
|
1333
|
+
145
|
1334
|
+
146
|
1335
|
+
147
|
1336
|
+
148
|
1337
|
+
149</pre>
|
1338
|
+
</td>
|
1339
|
+
<td>
|
1340
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 124</span>
|
1341
|
+
|
1342
|
+
<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>
|
1343
|
+
<span class='id identifier rubyid_db_table'>db_table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Table.html#initialize-instance_method" title="DWH::Table#initialize (method)">new</a></span></span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span>
|
1344
|
+
<span class='id identifier rubyid_sql'>sql</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SELECT column_name, data_type, character_maximum_length, numeric_precision,numeric_scale FROM duckdb_columns</span><span class='tstring_end'>'</span></span>
|
1345
|
+
|
1346
|
+
<span class='id identifier rubyid_where'>where</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>table_name = '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_physical_name'>physical_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
1347
|
+
<span class='id identifier rubyid_where'>where</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>database_name = '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_catalog'>catalog</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_catalog'>catalog</span>
|
1348
|
+
|
1349
|
+
<span class='id identifier rubyid_where'>where</span> <span class='op'><<</span> <span class='kw'>if</span> <span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_schema'>schema</span>
|
1350
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>schema_name = '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_schema'>schema</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1351
|
+
<span class='kw'>else</span>
|
1352
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>schema_name = '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:schema</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1353
|
+
<span class='kw'>end</span>
|
1354
|
+
|
1355
|
+
<span class='id identifier rubyid_cols'>cols</span> <span class='op'>=</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sql'>sql</span><span class='embexpr_end'>}</span><span class='tstring_content'> WHERE </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_where'>where</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> AND </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1356
|
+
<span class='id identifier rubyid_cols'>cols</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</span><span class='op'>|</span>
|
1357
|
+
<span class='id identifier rubyid_db_table'>db_table</span> <span class='op'><<</span> <span class='const'><span class='object_link'><a href="../Column.html" title="DWH::Column (class)">Column</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Column.html#initialize-instance_method" title="DWH::Column#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
1358
|
+
<span class='label'>name:</span> <span class='id identifier rubyid_col'>col</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1359
|
+
<span class='label'>data_type:</span> <span class='id identifier rubyid_col'>col</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1360
|
+
<span class='label'>precision:</span> <span class='id identifier rubyid_col'>col</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1361
|
+
<span class='label'>scale:</span> <span class='id identifier rubyid_col'>col</span><span class='lbracket'>[</span><span class='int'>4</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1362
|
+
<span class='label'>max_char_length:</span> <span class='id identifier rubyid_col'>col</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
|
1363
|
+
<span class='rparen'>)</span>
|
1364
|
+
<span class='kw'>end</span>
|
1365
|
+
|
1366
|
+
<span class='id identifier rubyid_db_table'>db_table</span>
|
1367
|
+
<span class='kw'>end</span></pre>
|
1368
|
+
</td>
|
1369
|
+
</tr>
|
1370
|
+
</table>
|
1371
|
+
</div>
|
1372
|
+
|
1373
|
+
<div class="method_details ">
|
1374
|
+
<h3 class="signature " id="schema?-instance_method">
|
1375
|
+
|
1376
|
+
#<strong>schema?</strong> ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
1377
|
+
|
1378
|
+
|
1379
|
+
|
1380
|
+
|
1381
|
+
|
1382
|
+
</h3><div class="docstring">
|
1383
|
+
<div class="discussion">
|
1384
|
+
<p>True if the configuration was setup with a schema.</p>
|
1385
|
+
|
1386
|
+
|
1387
|
+
</div>
|
1388
|
+
</div>
|
1389
|
+
<div class="tags">
|
1390
|
+
|
1391
|
+
<p class="tag_title">Returns:</p>
|
1392
|
+
<ul class="return">
|
1393
|
+
|
1394
|
+
<li>
|
1395
|
+
|
1396
|
+
|
1397
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1398
|
+
|
1399
|
+
|
1400
|
+
|
1401
|
+
</li>
|
1402
|
+
|
1403
|
+
</ul>
|
1404
|
+
|
1405
|
+
</div><table class="source_code">
|
1406
|
+
<tr>
|
1407
|
+
<td>
|
1408
|
+
<pre class="lines">
|
1409
|
+
|
1410
|
+
|
1411
|
+
152
|
1412
|
+
153
|
1413
|
+
154</pre>
|
1414
|
+
</td>
|
1415
|
+
<td>
|
1416
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 152</span>
|
1417
|
+
|
1418
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema?'>schema?</span>
|
1419
|
+
<span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:schema</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1420
|
+
<span class='kw'>end</span></pre>
|
1421
|
+
</td>
|
1422
|
+
</tr>
|
1423
|
+
</table>
|
1424
|
+
</div>
|
1425
|
+
|
1426
|
+
<div class="method_details ">
|
1427
|
+
<h3 class="signature " id="stats-instance_method">
|
1428
|
+
|
1429
|
+
#<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>
|
1430
|
+
|
1431
|
+
|
1432
|
+
|
1433
|
+
|
1434
|
+
|
1435
|
+
</h3><div class="docstring">
|
1436
|
+
<div class="discussion">
|
1437
|
+
<p>Returns basic stats of a given table. Will typically include row_count,
|
1438
|
+
date_start, and date_end.</p>
|
1439
|
+
|
1440
|
+
|
1441
|
+
</div>
|
1442
|
+
</div>
|
1443
|
+
<div class="tags">
|
1444
|
+
|
1445
|
+
<div class="examples">
|
1446
|
+
<h4 class="tag_title">Examples:</h4>
|
1447
|
+
|
1448
|
+
|
1449
|
+
<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>
|
1450
|
+
<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>
|
1451
|
+
<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>
|
1452
|
+
|
1453
|
+
</div>
|
1454
|
+
<p class="tag_title">Parameters:</p>
|
1455
|
+
<ul class="param">
|
1456
|
+
|
1457
|
+
<li>
|
1458
|
+
|
1459
|
+
<span class='name'>table</span>
|
1460
|
+
|
1461
|
+
|
1462
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1463
|
+
|
1464
|
+
|
1465
|
+
|
1466
|
+
—
|
1467
|
+
<div class='inline'><p>table name</p>
|
1468
|
+
</div>
|
1469
|
+
|
1470
|
+
</li>
|
1471
|
+
|
1472
|
+
<li>
|
1473
|
+
|
1474
|
+
<span class='name'>date_column</span>
|
1475
|
+
|
1476
|
+
|
1477
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1478
|
+
|
1479
|
+
|
1480
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1481
|
+
|
1482
|
+
|
1483
|
+
—
|
1484
|
+
<div class='inline'><p>optional date column to use to find range</p>
|
1485
|
+
</div>
|
1486
|
+
|
1487
|
+
</li>
|
1488
|
+
|
1489
|
+
<li>
|
1490
|
+
|
1491
|
+
<span class='name'>qualifiers</span>
|
1492
|
+
|
1493
|
+
|
1494
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1495
|
+
|
1496
|
+
|
1497
|
+
|
1498
|
+
—
|
1499
|
+
<div class='inline'><p>a customizable set of options</p>
|
1500
|
+
</div>
|
1501
|
+
|
1502
|
+
</li>
|
1503
|
+
|
1504
|
+
</ul>
|
1505
|
+
|
1506
|
+
|
1507
|
+
|
1508
|
+
|
1509
|
+
|
1510
|
+
|
1511
|
+
|
1512
|
+
|
1513
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
1514
|
+
<ul class="option">
|
1515
|
+
|
1516
|
+
<li>
|
1517
|
+
<span class="name">:catalog</span>
|
1518
|
+
<span class="type">(<tt>String</tt>)</span>
|
1519
|
+
<span class="default">
|
1520
|
+
|
1521
|
+
</span>
|
1522
|
+
|
1523
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
1524
|
+
will be ignored if the adapter doesn’t support</p>
|
1525
|
+
</div>
|
1526
|
+
|
1527
|
+
</li>
|
1528
|
+
|
1529
|
+
<li>
|
1530
|
+
<span class="name">:schema</span>
|
1531
|
+
<span class="type">(<tt>String</tt>)</span>
|
1532
|
+
<span class="default">
|
1533
|
+
|
1534
|
+
</span>
|
1535
|
+
|
1536
|
+
— <div class='inline'><p>optional schema to scope to.
|
1537
|
+
will be ignored if the adapter doesn’t support</p>
|
1538
|
+
</div>
|
1539
|
+
|
1540
|
+
</li>
|
1541
|
+
|
1542
|
+
</ul>
|
1543
|
+
|
1544
|
+
|
1545
|
+
<p class="tag_title">Returns:</p>
|
1546
|
+
<ul class="return">
|
1547
|
+
|
1548
|
+
<li>
|
1549
|
+
|
1550
|
+
|
1551
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">DWH::Table</a></span></tt>)</span>
|
1552
|
+
|
1553
|
+
|
1554
|
+
|
1555
|
+
</li>
|
1556
|
+
|
1557
|
+
</ul>
|
1558
|
+
<p class="tag_title">Raises:</p>
|
1559
|
+
<ul class="raise">
|
1560
|
+
|
1561
|
+
<li>
|
1562
|
+
|
1563
|
+
|
1564
|
+
<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>
|
1565
|
+
|
1566
|
+
|
1567
|
+
|
1568
|
+
</li>
|
1569
|
+
|
1570
|
+
</ul>
|
1571
|
+
|
1572
|
+
</div><table class="source_code">
|
1573
|
+
<tr>
|
1574
|
+
<td>
|
1575
|
+
<pre class="lines">
|
1576
|
+
|
1577
|
+
|
1578
|
+
104
|
1579
|
+
105
|
1580
|
+
106
|
1581
|
+
107
|
1582
|
+
108
|
1583
|
+
109
|
1584
|
+
110
|
1585
|
+
111
|
1586
|
+
112
|
1587
|
+
113
|
1588
|
+
114
|
1589
|
+
115
|
1590
|
+
116
|
1591
|
+
117
|
1592
|
+
118
|
1593
|
+
119
|
1594
|
+
120
|
1595
|
+
121</pre>
|
1596
|
+
</td>
|
1597
|
+
<td>
|
1598
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 104</span>
|
1599
|
+
|
1600
|
+
<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>
|
1601
|
+
<span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='lbracket'>[</span><span class='symbol'>:schema</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:schema</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='lbracket'>[</span><span class='symbol'>:schema</span><span class='rbracket'>]</span>
|
1602
|
+
<span class='id identifier rubyid_db_table'>db_table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Table.html" title="DWH::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Table.html#initialize-instance_method" title="DWH::Table#initialize (method)">new</a></span></span> <span class='id identifier rubyid_table'>table</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_qualifiers'>qualifiers</span>
|
1603
|
+
|
1604
|
+
<span class='id identifier rubyid_sql'>sql</span> <span class='op'>=</span> <span class='heredoc_beg'><<-SQL</span>
|
1605
|
+
<span class='tstring_content'> SELECT count(*) ROW_COUNT
|
1606
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_date_column'>date_column</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>, min(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_date_column'>date_column</span><span class='embexpr_end'>}</span><span class='tstring_content'>) DATE_START</span><span class='tstring_end'>"</span></span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
1607
|
+
</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_date_column'>date_column</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>, max(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_date_column'>date_column</span><span class='embexpr_end'>}</span><span class='tstring_content'>) DATE_END</span><span class='tstring_end'>"</span></span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
1608
|
+
FROM </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_db_table'>db_table</span><span class='period'>.</span><span class='id identifier rubyid_fully_qualified_table_name'>fully_qualified_table_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>
|
1609
|
+
</span><span class='heredoc_end'> SQL
|
1610
|
+
</span>
|
1611
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span>
|
1612
|
+
<span class='const'><span class='object_link'><a href="../TableStats.html" title="DWH::TableStats (class)">TableStats</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../TableStats.html#initialize-instance_method" title="DWH::TableStats#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
1613
|
+
<span class='label'>row_count:</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1614
|
+
<span class='label'>date_start:</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1615
|
+
<span class='label'>date_end:</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span>
|
1616
|
+
<span class='rparen'>)</span>
|
1617
|
+
<span class='kw'>end</span></pre>
|
1618
|
+
</td>
|
1619
|
+
</tr>
|
1620
|
+
</table>
|
1621
|
+
</div>
|
1622
|
+
|
1623
|
+
<div class="method_details ">
|
1624
|
+
<h3 class="signature " id="stream-instance_method">
|
1625
|
+
|
1626
|
+
#<strong>stream</strong>(sql) {|chunk| ... } ⇒ <tt>Object</tt>
|
1627
|
+
|
1628
|
+
|
1629
|
+
|
1630
|
+
|
1631
|
+
|
1632
|
+
</h3><div class="docstring">
|
1633
|
+
<div class="discussion">
|
1634
|
+
<p>Executes the given sql and yields the streamed results
|
1635
|
+
to the given block.</p>
|
1636
|
+
|
1637
|
+
|
1638
|
+
</div>
|
1639
|
+
</div>
|
1640
|
+
<div class="tags">
|
1641
|
+
<p class="tag_title">Parameters:</p>
|
1642
|
+
<ul class="param">
|
1643
|
+
|
1644
|
+
<li>
|
1645
|
+
|
1646
|
+
<span class='name'>sql</span>
|
1647
|
+
|
1648
|
+
|
1649
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1650
|
+
|
1651
|
+
|
1652
|
+
|
1653
|
+
—
|
1654
|
+
<div class='inline'><p>actual sql</p>
|
1655
|
+
</div>
|
1656
|
+
|
1657
|
+
</li>
|
1658
|
+
|
1659
|
+
</ul>
|
1660
|
+
|
1661
|
+
<p class="tag_title">Yields:</p>
|
1662
|
+
<ul class="yield">
|
1663
|
+
|
1664
|
+
<li>
|
1665
|
+
|
1666
|
+
|
1667
|
+
<span class='type'>(<tt>chunk</tt>)</span>
|
1668
|
+
|
1669
|
+
|
1670
|
+
|
1671
|
+
—
|
1672
|
+
<div class='inline'><p>Yields a streamed chunk as it streams in. The chunk type
|
1673
|
+
might vary depending on the target db and settings</p>
|
1674
|
+
</div>
|
1675
|
+
|
1676
|
+
</li>
|
1677
|
+
|
1678
|
+
</ul>
|
1679
|
+
<p class="tag_title">Raises:</p>
|
1680
|
+
<ul class="raise">
|
1681
|
+
|
1682
|
+
<li>
|
1683
|
+
|
1684
|
+
|
1685
|
+
<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>
|
1686
|
+
|
1687
|
+
|
1688
|
+
|
1689
|
+
</li>
|
1690
|
+
|
1691
|
+
</ul>
|
1692
|
+
|
1693
|
+
</div><table class="source_code">
|
1694
|
+
<tr>
|
1695
|
+
<td>
|
1696
|
+
<pre class="lines">
|
1697
|
+
|
1698
|
+
|
1699
|
+
199
|
1700
|
+
200
|
1701
|
+
201
|
1702
|
+
202
|
1703
|
+
203
|
1704
|
+
204
|
1705
|
+
205
|
1706
|
+
206</pre>
|
1707
|
+
</td>
|
1708
|
+
<td>
|
1709
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 199</span>
|
1710
|
+
|
1711
|
+
<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>
|
1712
|
+
<span class='id identifier rubyid_with_debug'>with_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1713
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span>
|
1714
|
+
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
|
1715
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
1716
|
+
<span class='kw'>end</span>
|
1717
|
+
<span class='kw'>end</span>
|
1718
|
+
<span class='kw'>end</span></pre>
|
1719
|
+
</td>
|
1720
|
+
</tr>
|
1721
|
+
</table>
|
1722
|
+
</div>
|
1723
|
+
|
1724
|
+
<div class="method_details ">
|
1725
|
+
<h3 class="signature " id="tables-instance_method">
|
1726
|
+
|
1727
|
+
#<strong>tables</strong>(**qualifiers) ⇒ <tt>Array<String></tt>
|
1728
|
+
|
1729
|
+
|
1730
|
+
|
1731
|
+
|
1732
|
+
|
1733
|
+
</h3><div class="docstring">
|
1734
|
+
<div class="discussion">
|
1735
|
+
<p>Get all tables available in the
|
1736
|
+
target db. It will use the default catalog and schema
|
1737
|
+
config only specified here.</p>
|
1738
|
+
|
1739
|
+
|
1740
|
+
</div>
|
1741
|
+
</div>
|
1742
|
+
<div class="tags">
|
1743
|
+
<p class="tag_title">Parameters:</p>
|
1744
|
+
<ul class="param">
|
1745
|
+
|
1746
|
+
<li>
|
1747
|
+
|
1748
|
+
<span class='name'>qualifiers</span>
|
1749
|
+
|
1750
|
+
|
1751
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1752
|
+
|
1753
|
+
|
1754
|
+
|
1755
|
+
—
|
1756
|
+
<div class='inline'><p>a customizable set of options</p>
|
1757
|
+
</div>
|
1758
|
+
|
1759
|
+
</li>
|
1760
|
+
|
1761
|
+
</ul>
|
1762
|
+
|
1763
|
+
|
1764
|
+
|
1765
|
+
|
1766
|
+
<p class="tag_title">Options Hash (<tt>**qualifiers</tt>):</p>
|
1767
|
+
<ul class="option">
|
1768
|
+
|
1769
|
+
<li>
|
1770
|
+
<span class="name">:catalog</span>
|
1771
|
+
<span class="type">(<tt>String</tt>)</span>
|
1772
|
+
<span class="default">
|
1773
|
+
|
1774
|
+
</span>
|
1775
|
+
|
1776
|
+
— <div class='inline'><p>optional catalog or equivalent name space.
|
1777
|
+
will be ignored if the adapter doesn’t support</p>
|
1778
|
+
</div>
|
1779
|
+
|
1780
|
+
</li>
|
1781
|
+
|
1782
|
+
<li>
|
1783
|
+
<span class="name">:schema</span>
|
1784
|
+
<span class="type">(<tt>String</tt>)</span>
|
1785
|
+
<span class="default">
|
1786
|
+
|
1787
|
+
</span>
|
1788
|
+
|
1789
|
+
— <div class='inline'><p>optional schema to scope to.
|
1790
|
+
will be ignored if the adapter doesn’t support</p>
|
1791
|
+
</div>
|
1792
|
+
|
1793
|
+
</li>
|
1794
|
+
|
1795
|
+
</ul>
|
1796
|
+
|
1797
|
+
|
1798
|
+
<p class="tag_title">Returns:</p>
|
1799
|
+
<ul class="return">
|
1800
|
+
|
1801
|
+
<li>
|
1802
|
+
|
1803
|
+
|
1804
|
+
<span class='type'>(<tt>Array<String></tt>)</span>
|
1805
|
+
|
1806
|
+
|
1807
|
+
|
1808
|
+
</li>
|
1809
|
+
|
1810
|
+
</ul>
|
1811
|
+
|
1812
|
+
</div><table class="source_code">
|
1813
|
+
<tr>
|
1814
|
+
<td>
|
1815
|
+
<pre class="lines">
|
1816
|
+
|
1817
|
+
|
1818
|
+
86
|
1819
|
+
87
|
1820
|
+
88
|
1821
|
+
89
|
1822
|
+
90
|
1823
|
+
91
|
1824
|
+
92
|
1825
|
+
93
|
1826
|
+
94
|
1827
|
+
95
|
1828
|
+
96
|
1829
|
+
97
|
1830
|
+
98
|
1831
|
+
99
|
1832
|
+
100
|
1833
|
+
101</pre>
|
1834
|
+
</td>
|
1835
|
+
<td>
|
1836
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 86</span>
|
1837
|
+
|
1838
|
+
<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>
|
1839
|
+
<span class='id identifier rubyid_catalog'>catalog</span><span class='comma'>,</span> <span class='id identifier rubyid_schema'>schema</span> <span class='op'>=</span> <span class='id identifier rubyid_qualifiers'>qualifiers</span><span class='period'>.</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='symbol'>:catalog</span><span class='comma'>,</span> <span class='symbol'>:schema</span><span class='rparen'>)</span>
|
1840
|
+
<span class='id identifier rubyid_sql'>sql</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SELECT table_name FROM duckdb_tables</span><span class='tstring_end'>'</span></span>
|
1841
|
+
|
1842
|
+
<span class='id identifier rubyid_where'>where</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1843
|
+
<span class='id identifier rubyid_where'>where</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>database_name = '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_catalog'>catalog</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_catalog'>catalog</span>
|
1844
|
+
|
1845
|
+
<span class='id identifier rubyid_where'>where</span> <span class='op'><<</span> <span class='kw'>if</span> <span class='id identifier rubyid_schema'>schema</span>
|
1846
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>schema_name = '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_schema'>schema</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1847
|
+
<span class='kw'>else</span>
|
1848
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>schema_name = '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='symbol'>:schema</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
1849
|
+
<span class='kw'>end</span>
|
1850
|
+
|
1851
|
+
<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sql'>sql</span><span class='embexpr_end'>}</span><span class='tstring_content'> WHERE </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_where'>where</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> AND </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1852
|
+
<span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
|
1853
|
+
<span class='kw'>end</span></pre>
|
1854
|
+
</td>
|
1855
|
+
</tr>
|
1856
|
+
</table>
|
1857
|
+
</div>
|
1858
|
+
|
1859
|
+
<div class="method_details ">
|
1860
|
+
<h3 class="signature " id="test_connection-instance_method">
|
1861
|
+
|
1862
|
+
#<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>
|
1863
|
+
|
1864
|
+
|
1865
|
+
|
1866
|
+
|
1867
|
+
|
1868
|
+
</h3><div class="docstring">
|
1869
|
+
<div class="discussion">
|
1870
|
+
<p>Tests the connection to the target database and returns true
|
1871
|
+
if successful, or raise Exception or false
|
1872
|
+
connection object or self</p>
|
1873
|
+
|
1874
|
+
|
1875
|
+
</div>
|
1876
|
+
</div>
|
1877
|
+
<div class="tags">
|
1878
|
+
|
1879
|
+
<p class="tag_title">Returns:</p>
|
1880
|
+
<ul class="return">
|
1881
|
+
|
1882
|
+
<li>
|
1883
|
+
|
1884
|
+
|
1885
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1886
|
+
|
1887
|
+
|
1888
|
+
|
1889
|
+
</li>
|
1890
|
+
|
1891
|
+
</ul>
|
1892
|
+
<p class="tag_title">Raises:</p>
|
1893
|
+
<ul class="raise">
|
1894
|
+
|
1895
|
+
<li>
|
1896
|
+
|
1897
|
+
|
1898
|
+
<span class='type'>(<tt><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></tt>)</span>
|
1899
|
+
|
1900
|
+
|
1901
|
+
|
1902
|
+
—
|
1903
|
+
<div class='inline'><p>when a connection cannot be made</p>
|
1904
|
+
</div>
|
1905
|
+
|
1906
|
+
</li>
|
1907
|
+
|
1908
|
+
</ul>
|
1909
|
+
|
1910
|
+
</div><table class="source_code">
|
1911
|
+
<tr>
|
1912
|
+
<td>
|
1913
|
+
<pre class="lines">
|
1914
|
+
|
1915
|
+
|
1916
|
+
76
|
1917
|
+
77
|
1918
|
+
78
|
1919
|
+
79
|
1920
|
+
80
|
1921
|
+
81
|
1922
|
+
82
|
1923
|
+
83</pre>
|
1924
|
+
</td>
|
1925
|
+
<td>
|
1926
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 76</span>
|
1927
|
+
|
1928
|
+
<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>
|
1929
|
+
<span class='id identifier rubyid_connection'>connection</span>
|
1930
|
+
<span class='kw'>true</span>
|
1931
|
+
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
1932
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ConnectionError.html" title="DWH::ConnectionError (class)">ConnectionError</a></span></span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='kw'>if</span> <span class='id identifier rubyid_raise_exception'>raise_exception</span>
|
1933
|
+
|
1934
|
+
<span class='kw'>false</span>
|
1935
|
+
<span class='kw'>end</span></pre>
|
1936
|
+
</td>
|
1937
|
+
</tr>
|
1938
|
+
</table>
|
1939
|
+
</div>
|
1940
|
+
|
1941
|
+
<div class="method_details ">
|
1942
|
+
<h3 class="signature " id="valid_config?-instance_method">
|
1943
|
+
|
1944
|
+
#<strong>valid_config?</strong> ⇒ <tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>
|
1945
|
+
|
1946
|
+
|
1947
|
+
|
1948
|
+
|
1949
|
+
|
1950
|
+
</h3><div class="docstring">
|
1951
|
+
<div class="discussion">
|
1952
|
+
|
1953
|
+
|
1954
|
+
|
1955
|
+
</div>
|
1956
|
+
</div>
|
1957
|
+
<div class="tags">
|
1958
|
+
|
1959
|
+
<p class="tag_title">Returns:</p>
|
1960
|
+
<ul class="return">
|
1961
|
+
|
1962
|
+
<li>
|
1963
|
+
|
1964
|
+
|
1965
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="DWH::Adapters::Boolean (class)">Boolean</a></span></tt>)</span>
|
1966
|
+
|
1967
|
+
|
1968
|
+
|
1969
|
+
</li>
|
1970
|
+
|
1971
|
+
</ul>
|
1972
|
+
|
1973
|
+
</div><table class="source_code">
|
1974
|
+
<tr>
|
1975
|
+
<td>
|
1976
|
+
<pre class="lines">
|
1977
|
+
|
1978
|
+
|
1979
|
+
208
|
1980
|
+
209
|
1981
|
+
210
|
1982
|
+
211
|
1983
|
+
212
|
1984
|
+
213</pre>
|
1985
|
+
</td>
|
1986
|
+
<td>
|
1987
|
+
<pre class="code"><span class="info file"># File 'lib/dwh/adapters/duck_db.rb', line 208</span>
|
1988
|
+
|
1989
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_valid_config?'>valid_config?</span>
|
1990
|
+
<span class='kw'>super</span>
|
1991
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>duckdb</span><span class='tstring_end'>'</span></span>
|
1992
|
+
<span class='kw'>rescue</span> <span class='const'>LoadError</span>
|
1993
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../ConfigError.html" title="DWH::ConfigError (class)">ConfigError</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Required 'duckdb' gem missing. Please add it to your Gemfile.</span><span class='tstring_end'>"</span></span>
|
1994
|
+
<span class='kw'>end</span></pre>
|
1995
|
+
</td>
|
1996
|
+
</tr>
|
1997
|
+
</table>
|
1998
|
+
</div>
|
1999
|
+
|
2000
|
+
</div>
|
2001
|
+
|
2002
|
+
</div>
|
2003
|
+
|
2004
|
+
<div id="footer">
|
2005
|
+
Generated on Fri Aug 22 08:31:22 2025 by
|
2006
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2007
|
+
0.9.37 (ruby-3.4.4).
|
2008
|
+
</div>
|
2009
|
+
|
2010
|
+
</div>
|
2011
|
+
</body>
|
2012
|
+
</html>
|