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.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +36 -0
  3. data/CHANGELOG.md +5 -0
  4. data/LICENSE +21 -0
  5. data/README.md +130 -0
  6. data/Rakefile +42 -0
  7. data/docs/DWH/Adapters/Adapter.html +3053 -0
  8. data/docs/DWH/Adapters/Athena.html +1704 -0
  9. data/docs/DWH/Adapters/Boolean.html +121 -0
  10. data/docs/DWH/Adapters/Druid.html +1626 -0
  11. data/docs/DWH/Adapters/DuckDb.html +2012 -0
  12. data/docs/DWH/Adapters/MySql.html +1704 -0
  13. data/docs/DWH/Adapters/OpenAuthorizable/ClassMethods.html +265 -0
  14. data/docs/DWH/Adapters/OpenAuthorizable.html +1102 -0
  15. data/docs/DWH/Adapters/Postgres.html +2000 -0
  16. data/docs/DWH/Adapters/Snowflake.html +1662 -0
  17. data/docs/DWH/Adapters/SqlServer.html +2084 -0
  18. data/docs/DWH/Adapters/Trino.html +1835 -0
  19. data/docs/DWH/Adapters.html +129 -0
  20. data/docs/DWH/AuthenticationError.html +142 -0
  21. data/docs/DWH/Behaviors.html +767 -0
  22. data/docs/DWH/Capabilities.html +748 -0
  23. data/docs/DWH/Column.html +1115 -0
  24. data/docs/DWH/ConfigError.html +143 -0
  25. data/docs/DWH/ConnectionError.html +143 -0
  26. data/docs/DWH/DWHError.html +138 -0
  27. data/docs/DWH/ExecutionError.html +143 -0
  28. data/docs/DWH/Factory.html +1133 -0
  29. data/docs/DWH/Functions/Arrays.html +505 -0
  30. data/docs/DWH/Functions/Dates.html +1644 -0
  31. data/docs/DWH/Functions/ExtractDatePart.html +804 -0
  32. data/docs/DWH/Functions/Nulls.html +377 -0
  33. data/docs/DWH/Functions.html +846 -0
  34. data/docs/DWH/Logger.html +258 -0
  35. data/docs/DWH/OAuthError.html +138 -0
  36. data/docs/DWH/Settings.html +658 -0
  37. data/docs/DWH/StreamingStats.html +804 -0
  38. data/docs/DWH/Table.html +1260 -0
  39. data/docs/DWH/TableStats.html +583 -0
  40. data/docs/DWH/TokenExpiredError.html +142 -0
  41. data/docs/DWH/UnsupportedCapability.html +135 -0
  42. data/docs/DWH.html +220 -0
  43. data/docs/_index.html +471 -0
  44. data/docs/class_list.html +54 -0
  45. data/docs/css/common.css +1 -0
  46. data/docs/css/full_list.css +58 -0
  47. data/docs/css/style.css +503 -0
  48. data/docs/file.README.html +210 -0
  49. data/docs/file.adapters.html +514 -0
  50. data/docs/file.creating-adapters.html +497 -0
  51. data/docs/file.getting-started.html +288 -0
  52. data/docs/file.usage.html +446 -0
  53. data/docs/file_list.html +79 -0
  54. data/docs/frames.html +22 -0
  55. data/docs/guides/adapters.md +445 -0
  56. data/docs/guides/creating-adapters.md +430 -0
  57. data/docs/guides/getting-started.md +225 -0
  58. data/docs/guides/usage.md +378 -0
  59. data/docs/index.html +210 -0
  60. data/docs/js/app.js +344 -0
  61. data/docs/js/full_list.js +242 -0
  62. data/docs/js/jquery.js +4 -0
  63. data/docs/method_list.html +2038 -0
  64. data/docs/top-level-namespace.html +110 -0
  65. data/lib/dwh/adapters/athena.rb +359 -0
  66. data/lib/dwh/adapters/druid.rb +267 -0
  67. data/lib/dwh/adapters/duck_db.rb +235 -0
  68. data/lib/dwh/adapters/my_sql.rb +235 -0
  69. data/lib/dwh/adapters/open_authorizable.rb +215 -0
  70. data/lib/dwh/adapters/postgres.rb +250 -0
  71. data/lib/dwh/adapters/snowflake.rb +489 -0
  72. data/lib/dwh/adapters/sql_server.rb +257 -0
  73. data/lib/dwh/adapters/trino.rb +213 -0
  74. data/lib/dwh/adapters.rb +363 -0
  75. data/lib/dwh/behaviors.rb +67 -0
  76. data/lib/dwh/capabilities.rb +39 -0
  77. data/lib/dwh/column.rb +79 -0
  78. data/lib/dwh/errors.rb +29 -0
  79. data/lib/dwh/factory.rb +125 -0
  80. data/lib/dwh/functions/arrays.rb +42 -0
  81. data/lib/dwh/functions/dates.rb +162 -0
  82. data/lib/dwh/functions/extract_date_part.rb +70 -0
  83. data/lib/dwh/functions/nulls.rb +31 -0
  84. data/lib/dwh/functions.rb +86 -0
  85. data/lib/dwh/logger.rb +50 -0
  86. data/lib/dwh/settings/athena.yml +77 -0
  87. data/lib/dwh/settings/base.yml +81 -0
  88. data/lib/dwh/settings/databricks.yml +51 -0
  89. data/lib/dwh/settings/druid.yml +59 -0
  90. data/lib/dwh/settings/duckdb.yml +44 -0
  91. data/lib/dwh/settings/mysql.yml +67 -0
  92. data/lib/dwh/settings/postgres.yml +30 -0
  93. data/lib/dwh/settings/redshift.yml +52 -0
  94. data/lib/dwh/settings/snowflake.yml +45 -0
  95. data/lib/dwh/settings/sqlserver.yml +80 -0
  96. data/lib/dwh/settings/trino.yml +77 -0
  97. data/lib/dwh/settings.rb +79 -0
  98. data/lib/dwh/streaming_stats.rb +69 -0
  99. data/lib/dwh/table.rb +105 -0
  100. data/lib/dwh/table_stats.rb +51 -0
  101. data/lib/dwh/version.rb +5 -0
  102. data/lib/dwh.rb +54 -0
  103. data/sig/dwh.rbs +4 -0
  104. metadata +231 -0
@@ -0,0 +1,846 @@
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
+ Module: DWH::Functions
8
+
9
+ &mdash; 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::Functions";
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 (F)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../DWH.html" title="DWH (module)">DWH</a></span></span>
41
+ &raquo;
42
+ <span class="title">Functions</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>Module: DWH::Functions
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dl>
75
+ <dt>Includes:</dt>
76
+ <dd><span class='object_link'><a href="Functions/Arrays.html" title="DWH::Functions::Arrays (module)">Arrays</a></span>, <span class='object_link'><a href="Functions/Dates.html" title="DWH::Functions::Dates (module)">Dates</a></span>, <span class='object_link'><a href="Functions/ExtractDatePart.html" title="DWH::Functions::ExtractDatePart (module)">ExtractDatePart</a></span>, <span class='object_link'><a href="Functions/Nulls.html" title="DWH::Functions::Nulls (module)">Nulls</a></span></dd>
77
+ </dl>
78
+
79
+
80
+
81
+
82
+ <dl>
83
+ <dt>Included in:</dt>
84
+ <dd><span class='object_link'><a href="Adapters/Adapter.html" title="DWH::Adapters::Adapter (class)">Adapters::Adapter</a></span></dd>
85
+ </dl>
86
+
87
+
88
+
89
+ <dl>
90
+ <dt>Defined in:</dt>
91
+ <dd>lib/dwh/functions.rb<span class="defines">,<br />
92
+ lib/dwh/functions/dates.rb,<br /> lib/dwh/functions/nulls.rb,<br /> lib/dwh/functions/arrays.rb,<br /> lib/dwh/functions/extract_date_part.rb</span>
93
+ </dd>
94
+ </dl>
95
+
96
+ </div>
97
+
98
+ <h2>Overview</h2><div class="docstring">
99
+ <div class="discussion">
100
+ <p>The Functions module adds a translation layer between this library
101
+ and native database functions. It relies on the adapters settings
102
+ file to map standard function to its native counterpart.</p>
103
+
104
+
105
+ </div>
106
+ </div>
107
+ <div class="tags">
108
+
109
+ <div class="examples">
110
+ <h4 class="tag_title">Examples:</h4>
111
+
112
+
113
+ <h5 class="example_title"><div class='inline'><p>Truncate date to the week start day</p>
114
+ </div></h5>
115
+
116
+ <pre class="example code"><code>truncate_date(&#39;week&#39;, &#39;my_date_col&#39;)
117
+ Postgres ==&gt; DATE_TRUNC(&#39;week&#39;, &#39;my_date_col&#39;)
118
+ SQL Server ==&gt; DATETRUNC(week, &#39;my_date_col&#39;)</code></pre>
119
+
120
+
121
+ <h5 class="example_title"><div class='inline'><p>Output a date string as a valid date literal</p>
122
+ </div></h5>
123
+
124
+ <pre class="example code"><code>date_literal(&#39;2025-08-06&#39;)
125
+ Postgres ==&gt; &#39;2025-08-06&#39;::DATE
126
+ SQL Server ==&gt; &#39;2025-08-06&#39;</code></pre>
127
+
128
+ </div>
129
+
130
+
131
+ </div><h2>Defined Under Namespace</h2>
132
+ <p class="children">
133
+
134
+
135
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Functions/Arrays.html" title="DWH::Functions::Arrays (module)">Arrays</a></span>, <span class='object_link'><a href="Functions/Dates.html" title="DWH::Functions::Dates (module)">Dates</a></span>, <span class='object_link'><a href="Functions/ExtractDatePart.html" title="DWH::Functions::ExtractDatePart (module)">ExtractDatePart</a></span>, <span class='object_link'><a href="Functions/Nulls.html" title="DWH::Functions::Nulls (module)">Nulls</a></span>
136
+
137
+
138
+
139
+
140
+ </p>
141
+
142
+
143
+
144
+ <h2>Constant Summary</h2>
145
+
146
+ <h3 class="inherited">Constants included
147
+ from <span class='object_link'><a href="Functions/Dates.html" title="DWH::Functions::Dates (module)">Dates</a></span></h3>
148
+ <p class="inherited"><span class='object_link'><a href="Functions/Dates.html#DATE_CLASSES-constant" title="DWH::Functions::Dates::DATE_CLASSES (constant)">Dates::DATE_CLASSES</a></span>, <span class='object_link'><a href="Functions/Dates.html#TIMESTAMPABLE_UNITS-constant" title="DWH::Functions::Dates::TIMESTAMPABLE_UNITS (constant)">Dates::TIMESTAMPABLE_UNITS</a></span></p>
149
+
150
+
151
+
152
+
153
+
154
+
155
+ <h2>
156
+ Instance Method Summary
157
+ <small><a href="#" class="summary_toggle">collapse</a></small>
158
+ </h2>
159
+
160
+ <ul class="summary">
161
+
162
+ <li class="public ">
163
+ <span class="summary_signature">
164
+
165
+ <a href="#cast-instance_method" title="#cast (instance method)">#<strong>cast</strong>(exp, type) &#x21d2; Object </a>
166
+
167
+
168
+
169
+ </span>
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+ <span class="summary_desc"><div class='inline'><p>Casts an expresion/literal to the target datatype.</p>
180
+ </div></span>
181
+
182
+ </li>
183
+
184
+
185
+ <li class="public ">
186
+ <span class="summary_signature">
187
+
188
+ <a href="#cross_join-instance_method" title="#cross_join (instance method)">#<strong>cross_join</strong>(relation) &#x21d2; Object </a>
189
+
190
+
191
+
192
+ </span>
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'><p>Applies adapter specific cross join expression This takes the target table.</p>
203
+ </div></span>
204
+
205
+ </li>
206
+
207
+
208
+ <li class="public ">
209
+ <span class="summary_signature">
210
+
211
+ <a href="#gsk-instance_method" title="#gsk (instance method)">#<strong>gsk</strong>(key) &#x21d2; String </a>
212
+
213
+
214
+
215
+ </span>
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ <span class="summary_desc"><div class='inline'><p>Shortcut to get settings value by key.</p>
226
+ </div></span>
227
+
228
+ </li>
229
+
230
+
231
+ <li class="public ">
232
+ <span class="summary_signature">
233
+
234
+ <a href="#lower_case-instance_method" title="#lower_case (instance method)">#<strong>lower_case</strong>(exp) &#x21d2; Object </a>
235
+
236
+
237
+
238
+ </span>
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'>
249
+ </div></span>
250
+
251
+ </li>
252
+
253
+
254
+ <li class="public ">
255
+ <span class="summary_signature">
256
+
257
+ <a href="#quote-instance_method" title="#quote (instance method)">#<strong>quote</strong>(exp) &#x21d2; Object </a>
258
+
259
+
260
+
261
+ </span>
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+ <span class="summary_desc"><div class='inline'><p>Applies adapter specific quotes around the given expression.</p>
272
+ </div></span>
273
+
274
+ </li>
275
+
276
+
277
+ <li class="public ">
278
+ <span class="summary_signature">
279
+
280
+ <a href="#string_lit-instance_method" title="#string_lit (instance method)">#<strong>string_lit</strong>(exp) &#x21d2; Object </a>
281
+
282
+
283
+
284
+ </span>
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+ <span class="summary_desc"><div class='inline'><p>Applies adapter specific string literal translation around the given expression.</p>
295
+ </div></span>
296
+
297
+ </li>
298
+
299
+
300
+ <li class="public ">
301
+ <span class="summary_signature">
302
+
303
+ <a href="#trim-instance_method" title="#trim (instance method)">#<strong>trim</strong>(exp) &#x21d2; Object </a>
304
+
305
+
306
+
307
+ </span>
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+ <span class="summary_desc"><div class='inline'>
318
+ </div></span>
319
+
320
+ </li>
321
+
322
+
323
+ <li class="public ">
324
+ <span class="summary_signature">
325
+
326
+ <a href="#upper_case-instance_method" title="#upper_case (instance method)">#<strong>upper_case</strong>(exp) &#x21d2; Object </a>
327
+
328
+
329
+
330
+ </span>
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+ <span class="summary_desc"><div class='inline'>
341
+ </div></span>
342
+
343
+ </li>
344
+
345
+
346
+ </ul>
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Functions/Arrays.html" title="DWH::Functions::Arrays (module)">Arrays</a></span></h3>
359
+ <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>
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Functions/Nulls.html" title="DWH::Functions::Nulls (module)">Nulls</a></span></h3>
370
+ <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>
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Functions/ExtractDatePart.html" title="DWH::Functions::ExtractDatePart (module)">ExtractDatePart</a></span></h3>
381
+ <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>
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Functions/Dates.html" title="DWH::Functions::Dates (module)">Dates</a></span></h3>
392
+ <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>
393
+
394
+
395
+ <div id="instance_method_details" class="method_details_list">
396
+ <h2>Instance Method Details</h2>
397
+
398
+
399
+ <div class="method_details first">
400
+ <h3 class="signature first" id="cast-instance_method">
401
+
402
+ #<strong>cast</strong>(exp, type) &#x21d2; <tt>Object</tt>
403
+
404
+
405
+
406
+
407
+
408
+ </h3><div class="docstring">
409
+ <div class="discussion">
410
+ <p>Casts an expresion/literal to the target datatype.
411
+ Datatype should be valid for the target db.</p>
412
+
413
+
414
+ </div>
415
+ </div>
416
+ <div class="tags">
417
+ <p class="tag_title">Parameters:</p>
418
+ <ul class="param">
419
+
420
+ <li>
421
+
422
+ <span class='name'>exp</span>
423
+
424
+
425
+ <span class='type'>(<tt>String</tt>)</span>
426
+
427
+
428
+
429
+ &mdash;
430
+ <div class='inline'><p>sql expression</p>
431
+ </div>
432
+
433
+ </li>
434
+
435
+ <li>
436
+
437
+ <span class='name'>type</span>
438
+
439
+
440
+ <span class='type'>(<tt>String</tt>)</span>
441
+
442
+
443
+
444
+ &mdash;
445
+ <div class='inline'><p>valid type for target db</p>
446
+ </div>
447
+
448
+ </li>
449
+
450
+ </ul>
451
+
452
+
453
+ </div><table class="source_code">
454
+ <tr>
455
+ <td>
456
+ <pre class="lines">
457
+
458
+
459
+ 31
460
+ 32
461
+ 33
462
+ 34</pre>
463
+ </td>
464
+ <td>
465
+ <pre class="code"><span class="info file"># File 'lib/dwh/functions.rb', line 31</span>
466
+
467
+ <span class='kw'>def</span> <span class='id identifier rubyid_cast'>cast</span><span class='lparen'>(</span><span class='id identifier rubyid_exp'>exp</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
468
+ <span class='id identifier rubyid_gsk'>gsk</span><span class='lparen'>(</span><span class='symbol'>:cast</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@exp</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
469
+ <span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@type</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
470
+ <span class='kw'>end</span></pre>
471
+ </td>
472
+ </tr>
473
+ </table>
474
+ </div>
475
+
476
+ <div class="method_details ">
477
+ <h3 class="signature " id="cross_join-instance_method">
478
+
479
+ #<strong>cross_join</strong>(relation) &#x21d2; <tt>Object</tt>
480
+
481
+
482
+
483
+
484
+
485
+ </h3><div class="docstring">
486
+ <div class="discussion">
487
+ <p>Applies adapter specific cross join expression
488
+ This takes the target table. Ie if you are joining
489
+ table a with table b.. You will pass in the table b
490
+ name expression here.</p>
491
+
492
+
493
+ </div>
494
+ </div>
495
+ <div class="tags">
496
+
497
+ <div class="examples">
498
+ <h4 class="tag_title">Examples:</h4>
499
+
500
+
501
+ <pre class="example code"><code><span class='id identifier rubyid_adapter'>adapter</span><span class='period'>.</span><span class='id identifier rubyid_cross_join'>cross_join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>schema.table_b</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></code></pre>
502
+
503
+ </div>
504
+ <p class="tag_title">Parameters:</p>
505
+ <ul class="param">
506
+
507
+ <li>
508
+
509
+ <span class='name'>relation</span>
510
+
511
+
512
+ <span class='type'>(<tt>String</tt>)</span>
513
+
514
+
515
+
516
+ &mdash;
517
+ <div class='inline'><ul>
518
+ <li>table name or table exp</li>
519
+ </ul>
520
+ </div>
521
+
522
+ </li>
523
+
524
+ </ul>
525
+
526
+
527
+ </div><table class="source_code">
528
+ <tr>
529
+ <td>
530
+ <pre class="lines">
531
+
532
+
533
+ 74
534
+ 75
535
+ 76</pre>
536
+ </td>
537
+ <td>
538
+ <pre class="code"><span class="info file"># File 'lib/dwh/functions.rb', line 74</span>
539
+
540
+ <span class='kw'>def</span> <span class='id identifier rubyid_cross_join'>cross_join</span><span class='lparen'>(</span><span class='id identifier rubyid_relation'>relation</span><span class='rparen'>)</span>
541
+ <span class='id identifier rubyid_gsk'>gsk</span><span class='lparen'>(</span><span class='symbol'>:cross_join</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_sub'>sub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@relation</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='id identifier rubyid_relation'>relation</span><span class='rparen'>)</span>
542
+ <span class='kw'>end</span></pre>
543
+ </td>
544
+ </tr>
545
+ </table>
546
+ </div>
547
+
548
+ <div class="method_details ">
549
+ <h3 class="signature " id="gsk-instance_method">
550
+
551
+ #<strong>gsk</strong>(key) &#x21d2; <tt>String</tt>
552
+
553
+
554
+
555
+
556
+
557
+ </h3><div class="docstring">
558
+ <div class="discussion">
559
+ <p>Shortcut to get settings value
560
+ by key.</p>
561
+
562
+
563
+ </div>
564
+ </div>
565
+ <div class="tags">
566
+ <p class="tag_title">Parameters:</p>
567
+ <ul class="param">
568
+
569
+ <li>
570
+
571
+ <span class='name'>key</span>
572
+
573
+
574
+ <span class='type'>(<tt>Symbol</tt>, <tt>String</tt>)</span>
575
+
576
+
577
+
578
+ </li>
579
+
580
+ </ul>
581
+
582
+ <p class="tag_title">Returns:</p>
583
+ <ul class="return">
584
+
585
+ <li>
586
+
587
+
588
+ <span class='type'>(<tt>String</tt>)</span>
589
+
590
+
591
+
592
+ &mdash;
593
+ <div class='inline'><p>upcased value</p>
594
+ </div>
595
+
596
+ </li>
597
+
598
+ </ul>
599
+
600
+ </div><table class="source_code">
601
+ <tr>
602
+ <td>
603
+ <pre class="lines">
604
+
605
+
606
+ 82
607
+ 83
608
+ 84</pre>
609
+ </td>
610
+ <td>
611
+ <pre class="code"><span class="info file"># File 'lib/dwh/functions.rb', line 82</span>
612
+
613
+ <span class='kw'>def</span> <span class='id identifier rubyid_gsk'>gsk</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
614
+ <span class='id identifier rubyid_settings'>settings</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
615
+ <span class='kw'>end</span></pre>
616
+ </td>
617
+ </tr>
618
+ </table>
619
+ </div>
620
+
621
+ <div class="method_details ">
622
+ <h3 class="signature " id="lower_case-instance_method">
623
+
624
+ #<strong>lower_case</strong>(exp) &#x21d2; <tt>Object</tt>
625
+
626
+
627
+
628
+
629
+
630
+ </h3><table class="source_code">
631
+ <tr>
632
+ <td>
633
+ <pre class="lines">
634
+
635
+
636
+ 40
637
+ 41
638
+ 42</pre>
639
+ </td>
640
+ <td>
641
+ <pre class="code"><span class="info file"># File 'lib/dwh/functions.rb', line 40</span>
642
+
643
+ <span class='kw'>def</span> <span class='id identifier rubyid_lower_case'>lower_case</span><span class='lparen'>(</span><span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
644
+ <span class='id identifier rubyid_gsk'>gsk</span><span class='lparen'>(</span><span class='symbol'>:lower_case</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@exp</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
645
+ <span class='kw'>end</span></pre>
646
+ </td>
647
+ </tr>
648
+ </table>
649
+ </div>
650
+
651
+ <div class="method_details ">
652
+ <h3 class="signature " id="quote-instance_method">
653
+
654
+ #<strong>quote</strong>(exp) &#x21d2; <tt>Object</tt>
655
+
656
+
657
+
658
+
659
+
660
+ </h3><div class="docstring">
661
+ <div class="discussion">
662
+ <p>Applies adapter specific quotes around the given
663
+ expression. The expression is usually a column name, alias,
664
+ or table alias.</p>
665
+
666
+
667
+ </div>
668
+ </div>
669
+ <div class="tags">
670
+ <p class="tag_title">Parameters:</p>
671
+ <ul class="param">
672
+
673
+ <li>
674
+
675
+ <span class='name'>exp</span>
676
+
677
+
678
+ <span class='type'>(<tt>String</tt>)</span>
679
+
680
+
681
+
682
+ &mdash;
683
+ <div class='inline'><ul>
684
+ <li>column, alias, table name</li>
685
+ </ul>
686
+ </div>
687
+
688
+ </li>
689
+
690
+ </ul>
691
+
692
+
693
+ </div><table class="source_code">
694
+ <tr>
695
+ <td>
696
+ <pre class="lines">
697
+
698
+
699
+ 53
700
+ 54
701
+ 55</pre>
702
+ </td>
703
+ <td>
704
+ <pre class="code"><span class="info file"># File 'lib/dwh/functions.rb', line 53</span>
705
+
706
+ <span class='kw'>def</span> <span class='id identifier rubyid_quote'>quote</span><span class='lparen'>(</span><span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
707
+ <span class='id identifier rubyid_gsk'>gsk</span><span class='lparen'>(</span><span class='symbol'>:quote</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_sub'>sub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@exp</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
708
+ <span class='kw'>end</span></pre>
709
+ </td>
710
+ </tr>
711
+ </table>
712
+ </div>
713
+
714
+ <div class="method_details ">
715
+ <h3 class="signature " id="string_lit-instance_method">
716
+
717
+ #<strong>string_lit</strong>(exp) &#x21d2; <tt>Object</tt>
718
+
719
+
720
+
721
+
722
+
723
+ </h3><div class="docstring">
724
+ <div class="discussion">
725
+ <p>Applies adapter specific string literal translation around the given
726
+ expression. The expression is usually a string value.</p>
727
+
728
+
729
+ </div>
730
+ </div>
731
+ <div class="tags">
732
+ <p class="tag_title">Parameters:</p>
733
+ <ul class="param">
734
+
735
+ <li>
736
+
737
+ <span class='name'>exp</span>
738
+
739
+
740
+ <span class='type'>(<tt>String</tt>)</span>
741
+
742
+
743
+
744
+ &mdash;
745
+ <div class='inline'><p>some string value</p>
746
+ </div>
747
+
748
+ </li>
749
+
750
+ </ul>
751
+
752
+
753
+ </div><table class="source_code">
754
+ <tr>
755
+ <td>
756
+ <pre class="lines">
757
+
758
+
759
+ 61
760
+ 62
761
+ 63</pre>
762
+ </td>
763
+ <td>
764
+ <pre class="code"><span class="info file"># File 'lib/dwh/functions.rb', line 61</span>
765
+
766
+ <span class='kw'>def</span> <span class='id identifier rubyid_string_lit'>string_lit</span><span class='lparen'>(</span><span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
767
+ <span class='id identifier rubyid_gsk'>gsk</span><span class='lparen'>(</span><span class='symbol'>:string_literal</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_sub'>sub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@exp</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='id identifier rubyid_exp'>exp</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&#39;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&#39;&#39;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
768
+ <span class='kw'>end</span></pre>
769
+ </td>
770
+ </tr>
771
+ </table>
772
+ </div>
773
+
774
+ <div class="method_details ">
775
+ <h3 class="signature " id="trim-instance_method">
776
+
777
+ #<strong>trim</strong>(exp) &#x21d2; <tt>Object</tt>
778
+
779
+
780
+
781
+
782
+
783
+ </h3><table class="source_code">
784
+ <tr>
785
+ <td>
786
+ <pre class="lines">
787
+
788
+
789
+ 36
790
+ 37
791
+ 38</pre>
792
+ </td>
793
+ <td>
794
+ <pre class="code"><span class="info file"># File 'lib/dwh/functions.rb', line 36</span>
795
+
796
+ <span class='kw'>def</span> <span class='id identifier rubyid_trim'>trim</span><span class='lparen'>(</span><span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
797
+ <span class='id identifier rubyid_gsk'>gsk</span><span class='lparen'>(</span><span class='symbol'>:trim</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@exp</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
798
+ <span class='kw'>end</span></pre>
799
+ </td>
800
+ </tr>
801
+ </table>
802
+ </div>
803
+
804
+ <div class="method_details ">
805
+ <h3 class="signature " id="upper_case-instance_method">
806
+
807
+ #<strong>upper_case</strong>(exp) &#x21d2; <tt>Object</tt>
808
+
809
+
810
+
811
+
812
+
813
+ </h3><table class="source_code">
814
+ <tr>
815
+ <td>
816
+ <pre class="lines">
817
+
818
+
819
+ 44
820
+ 45
821
+ 46</pre>
822
+ </td>
823
+ <td>
824
+ <pre class="code"><span class="info file"># File 'lib/dwh/functions.rb', line 44</span>
825
+
826
+ <span class='kw'>def</span> <span class='id identifier rubyid_upper_case'>upper_case</span><span class='lparen'>(</span><span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
827
+ <span class='id identifier rubyid_gsk'>gsk</span><span class='lparen'>(</span><span class='symbol'>:upper_case</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@exp</span><span class='regexp_end'>/i</span></span><span class='comma'>,</span> <span class='id identifier rubyid_exp'>exp</span><span class='rparen'>)</span>
828
+ <span class='kw'>end</span></pre>
829
+ </td>
830
+ </tr>
831
+ </table>
832
+ </div>
833
+
834
+ </div>
835
+
836
+ </div>
837
+
838
+ <div id="footer">
839
+ Generated on Fri Aug 22 08:31:21 2025 by
840
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
841
+ 0.9.37 (ruby-3.4.4).
842
+ </div>
843
+
844
+ </div>
845
+ </body>
846
+ </html>