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,210 @@
|
|
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
|
+
File: README
|
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 = "README";
|
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="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'>
|
61
|
+
<p><a href="https://github.com/stratasite/dwh/actions"><img src="https://github.com/stratasite/dwh/workflows/Ruby/badge.svg" alt="Ruby" /></a></p>
|
62
|
+
|
63
|
+
<h1 id="dwh---data-warehouse-adapter-library">DWH - Data Warehouse Adapter Library</h1>
|
64
|
+
|
65
|
+
<p>A light weight library to connect, introspect, and query popular databases over a unified interface. This gem is intended for analtyical workloads. The library also provides database specific translations for common functions like <code>date_trunc</code>, <code>date_add</code> etc. The function tranlation is not comprehensive. But, it does provides good coverage for date handling, and some array handling as well.</p>
|
66
|
+
|
67
|
+
<blockquote>
|
68
|
+
<p>[!NOTE]
|
69
|
+
<strong>This is not an ORM</strong> nor will it cast types to ruby unless the underlying client does it out of the box. The goal here is to create an Architecture where new databases can be onboarded quickly.</p>
|
70
|
+
</blockquote>
|
71
|
+
|
72
|
+
<h2 id="why-do-we-need-another-database-abstraction-layer">Why do we need another database abstraction layer?</h2>
|
73
|
+
|
74
|
+
<p>Libraries like <a href="https://github.com/jeremyevans/sequel">Sequel</a> are amazing and comprehensive. However, its broad coverage also makes it more laborious to add new databases. Especially, ones with only HTTP endpoints for Ruby. We seem to be having an explosion of databases recently and a light weight interface will allow us to integrate faster.</p>
|
75
|
+
|
76
|
+
<p>The adapter only has 5 core methods (6 including the connection method). A YAML settings controls how it interacts with a particular db. It is relatively fast to add a new db. See the <a href="http://github.com/stratasite/dwh/blob/main/lib/dwh/adapters/druid.rb">Druid</a> implementation as an example. And <a href="https://github.com/stratasite/dwh/blob/main/lib/dwh/settings/druid.yml">here</a> is its corresponding YAML settings file.</p>
|
77
|
+
|
78
|
+
<h2 id="features">Features</h2>
|
79
|
+
|
80
|
+
<ul>
|
81
|
+
<li><strong>Unified Interface</strong>: Connect to multiple database types using the same API</li>
|
82
|
+
<li><strong>SQL Function Translation</strong>: Automatically translates common SQL functions to database-specific syntax</li>
|
83
|
+
<li><strong>Connection Pooling</strong>: Built-in connection pool management for high-performance applications</li>
|
84
|
+
<li><strong>Rich Metadata</strong>: Extract table schemas, column information, and statistics</li>
|
85
|
+
</ul>
|
86
|
+
|
87
|
+
<h2 id="supported-databases">Supported Databases</h2>
|
88
|
+
|
89
|
+
<ul>
|
90
|
+
<li><strong>Snowflake</strong> - High performance cloud warehouse</li>
|
91
|
+
<li><strong>Trino</strong> (formerly Presto) - Distributed SQL query engine</li>
|
92
|
+
<li><strong>AWS Athena</strong> - AWS big data warehouse</li>
|
93
|
+
<li><strong>Apache Druid</strong> - Real-time analytics database</li>
|
94
|
+
<li><strong>DuckDB</strong> - In-process analytical database</li>
|
95
|
+
<li><strong>PostgreSQL</strong> - Full-featured RDBMS with advanced SQL support</li>
|
96
|
+
<li><strong>MySQL</strong> - Popular open-source database</li>
|
97
|
+
<li><strong>SQL Server</strong> - Microsoft’s enterprise database</li>
|
98
|
+
</ul>
|
99
|
+
|
100
|
+
<h2 id="integrations-coming-soon">Integrations Coming Soon</h2>
|
101
|
+
|
102
|
+
<ul>
|
103
|
+
<li><strong>Redshift</strong> - AWS data warehouse platform</li>
|
104
|
+
<li><strong>ClickHouse</strong> - High performance analytical db</li>
|
105
|
+
<li><strong>Databricks</strong> - Big data compute engine</li>
|
106
|
+
<li><strong>MotherDuck</strong> - Hosted DuckDB service</li>
|
107
|
+
</ul>
|
108
|
+
|
109
|
+
<h2 id="quick-start">Quick Start</h2>
|
110
|
+
|
111
|
+
<p>Install it yourself as:</p>
|
112
|
+
|
113
|
+
<p><code>bash
|
114
|
+
gem install dwh
|
115
|
+
</code></p>
|
116
|
+
|
117
|
+
<h3 id="connect-and-execute-a-basic-query">Connect and Execute a Basic Query</h3>
|
118
|
+
|
119
|
+
<p>```ruby
|
120
|
+
require ‘dwh’</p>
|
121
|
+
|
122
|
+
<h1 id="connect-to-druid">Connect to Druid</h1>
|
123
|
+
<p>druid = DWH.create(:druid, {
|
124
|
+
host: ‘localhost’,
|
125
|
+
port: 8080,
|
126
|
+
protocol: ‘http’
|
127
|
+
})</p>
|
128
|
+
|
129
|
+
<h1 id="basic-query-execution">basic query execution</h1>
|
130
|
+
<p>results = druid.execute(“SELECT * FROM web_sales”, format: :csv)
|
131
|
+
```</p>
|
132
|
+
|
133
|
+
<h2 id="core-api">Core API</h2>
|
134
|
+
|
135
|
+
<p>Standardized API across adapters:</p>
|
136
|
+
|
137
|
+
<dl>
|
138
|
+
<dt>connection</dt>
|
139
|
+
<dd>Creates a reusuable connection based on config hash passed in</dd>
|
140
|
+
<dt>tables(schema: nil, catalog: nil)</dt>
|
141
|
+
<dd> returns a list of tables from the default connection or from the specified schema and catalog </dd>
|
142
|
+
<dt> metadata(table_name, schema: nil, catalog: nil) </dt>
|
143
|
+
<dd> provides metadata about a table </dd>
|
144
|
+
<dt>stats(table_name, date_column: nil) </dt>
|
145
|
+
<dd> provides table row count and date range </dd>
|
146
|
+
<dt> execute(sql, format: :array, retries: 0) </dt>
|
147
|
+
<dd> runs a query and returns in given format </dd>
|
148
|
+
<dt> execute_stream(sql, io, stats: nil) </dt>
|
149
|
+
<dd> runs a query and streams it as csv into the given io </dd>
|
150
|
+
</dl>
|
151
|
+
|
152
|
+
<h2 id="tutorials-and-guides">Tutorials and Guides</h2>
|
153
|
+
|
154
|
+
<ul>
|
155
|
+
<li><a href="/docs/guides/getting-started.md">Getting Started</a></li>
|
156
|
+
<li><a href="/docs/guides/adapters.md">Adapter Configuration</a></li>
|
157
|
+
<li><a href="/docs/guides/creating-adapters.md">Creating an Adapter</a></li>
|
158
|
+
<li><a href="https://rubydoc.info/github/stratasite/dwh.git">API</a></li>
|
159
|
+
</ul>
|
160
|
+
|
161
|
+
<h2 id="testing">Testing</h2>
|
162
|
+
|
163
|
+
<p>Certain databases have to be tested via docker. Those tests will try to launch docker compose services in <code>test/support/compose*.yml</code></p>
|
164
|
+
|
165
|
+
<p>Run Unit Tests:</p>
|
166
|
+
|
167
|
+
<p><code>bash
|
168
|
+
bundle exec rake test:unit
|
169
|
+
</code></p>
|
170
|
+
|
171
|
+
<p>Run tests on RDBMS dbs:</p>
|
172
|
+
|
173
|
+
<p><code>bash
|
174
|
+
bundle exec rake test:system:rdbms
|
175
|
+
</code></p>
|
176
|
+
|
177
|
+
<p>Run tests on druid:</p>
|
178
|
+
|
179
|
+
<p><code>bash
|
180
|
+
bundle exec rake test:system:druid
|
181
|
+
</code></p>
|
182
|
+
|
183
|
+
<h2 id="development">Development</h2>
|
184
|
+
|
185
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake test</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt.</p>
|
186
|
+
|
187
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake install</code>.</p>
|
188
|
+
|
189
|
+
<h2 id="contributing">Contributing</h2>
|
190
|
+
|
191
|
+
<p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/stratasite/dwh">https://github.com/stratasite/dwh</a>.</p>
|
192
|
+
|
193
|
+
<h2 id="license">License</h2>
|
194
|
+
|
195
|
+
<p>This project is available as open source under the terms of the MIT License.</p>
|
196
|
+
|
197
|
+
<h2 id="version">Version</h2>
|
198
|
+
|
199
|
+
<p>Current version: 0.1.0</p>
|
200
|
+
</div></div>
|
201
|
+
|
202
|
+
<div id="footer">
|
203
|
+
Generated on Fri Aug 22 08:31:21 2025 by
|
204
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
205
|
+
0.9.37 (ruby-3.4.4).
|
206
|
+
</div>
|
207
|
+
|
208
|
+
</div>
|
209
|
+
</body>
|
210
|
+
</html>
|