forked from tripl-ai/arc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
705 lines (401 loc) · 23.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
<!DOCTYPE html>
<html class="no-js">
<head lang="en-us">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<title>Arc</title>
<meta name="generator" content="Hugo 0.51" />
<meta name="description" content="Arc is an opinionated framework for defining data pipelines which are predictable, repeatable and manageable.">
<link rel="canonical" href="https://arc.tripl.ai/">
<meta name="author" content="ai.tripl.arc">
<meta property="og:url" content="https://arc.tripl.ai/">
<meta property="og:title" content="Arc">
<meta property="og:image" content="https://arc.tripl.ai/images/logo.png">
<meta name="apple-mobile-web-app-title" content="Arc">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="shortcut icon" type="image/x-icon" href="https://arc.tripl.ai/images/favicon.ico">
<link rel="icon" type="image/x-icon" href="https://arc.tripl.ai/images/favicon.ico">
<style>
@font-face {
font-family: 'Icon';
src: url('https://arc.tripl.ai/fonts/icon.eot');
src: url('https://arc.tripl.ai/fonts/icon.eot')
format('embedded-opentype'),
url('https://arc.tripl.ai/fonts/icon.woff')
format('woff'),
url('https://arc.tripl.ai/fonts/icon.ttf')
format('truetype'),
url('https://arc.tripl.ai/fonts/icon.svg')
format('svg');
font-weight: normal;
font-style: normal;
}
</style>
<link rel="stylesheet" href="https://arc.tripl.ai/stylesheets/application.css">
<link rel="stylesheet" href="https://arc.tripl.ai/stylesheets/temporary.css">
<link rel="stylesheet" href="https://arc.tripl.ai/stylesheets/palettes.css">
<link rel="stylesheet" href="https://arc.tripl.ai/stylesheets/highlight/highlight.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu:400,700|Ubuntu+Mono">
<style>
body, input {
font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
}
pre, code {
font-family: 'Ubuntu Mono', 'Courier New', 'Courier', monospace;
}
</style>
<script src="https://arc.tripl.ai/javascripts/modernizr.js"></script>
<link href="https://arc.tripl.ai/index.xml" rel="alternate" type="application/rss+xml" title="Arc" />
<link href="https://arc.tripl.ai/index.xml" rel="feed" type="application/rss+xml" title="Arc" />
</head>
<body class="palette-primary-red palette-accent-red">
<div class="backdrop">
<div class="backdrop-paper"></div>
</div>
<input class="toggle" type="checkbox" id="toggle-drawer">
<input class="toggle" type="checkbox" id="toggle-search">
<label class="toggle-button overlay" for="toggle-drawer"></label>
<header class="header">
<nav aria-label="Header">
<div class="bar default">
<div class="button button-menu" role="button" aria-label="Menu">
<label class="toggle-button icon icon-menu" for="toggle-drawer">
<span></span>
</label>
</div>
<div class="stretch">
<div class="title">
Arc
</div>
</div>
<div class="button button-github" role="button" aria-label="GitHub">
<a href="https://github.com/tripl-ai/arc" title="@https://github.com/tripl-ai/arc on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
</div>
</div>
<div class="bar search">
<div class="button button-close" role="button" aria-label="Close">
<label class="toggle-button icon icon-back" for="toggle-search"></label>
</div>
<div class="stretch">
<div class="field">
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
</div>
</div>
<div class="button button-reset" role="button" aria-label="Search">
<button class="toggle-button icon icon-close" id="reset-search"></button>
</div>
</div>
</nav>
</header>
<main class="main">
<div class="drawer">
<nav aria-label="Navigation">
<a href="https://arc.tripl.ai/" class="project">
<div class="banner">
<div class="logo">
<img src="https://arc.tripl.ai/images/logo.png">
</div>
<div class="name">
<strong>Arc
<span class="version">2.1.0</span></strong>
<br> tripl-ai/arc
</div>
</div>
</a>
<div class="scrollable">
<div class="wrapper">
<div class="toc">
<ul>
<li>
<a title="Getting started" href="https://arc.tripl.ai/getting-started/">
Getting started
</a>
</li>
<li>
<a title="Tutorial" href="https://arc.tripl.ai/tutorial/">
Tutorial
</a>
</li>
<li>
<a title="Extract" href="https://arc.tripl.ai/extract/">
Extract
</a>
</li>
<li>
<a title="Transform" href="https://arc.tripl.ai/transform/">
Transform
</a>
</li>
<li>
<a title="Load" href="https://arc.tripl.ai/load/">
Load
</a>
</li>
<li>
<a title="Execute" href="https://arc.tripl.ai/execute/">
Execute
</a>
</li>
<li>
<a title="Validate" href="https://arc.tripl.ai/validate/">
Validate
</a>
</li>
<li>
<a title="Metadata" href="https://arc.tripl.ai/metadata/">
Metadata
</a>
</li>
<li>
<a title="Deploy" href="https://arc.tripl.ai/deploy/">
Deploy
</a>
</li>
<li>
<a title="Plugins" href="https://arc.tripl.ai/plugins/">
Plugins
</a>
</li>
<li>
<a title="Partials" href="https://arc.tripl.ai/partials/">
Partials
</a>
</li>
<li>
<a title="Patterns" href="https://arc.tripl.ai/patterns/">
Patterns
</a>
</li>
<li>
<a title="License" href="https://arc.tripl.ai/license/">
License
</a>
</li>
</ul>
<hr>
<span class="section">The author</span>
<ul>
<li>
<a href="https://github.com/tripl-ai" target="_blank" title="@tripl-ai on GitHub">
@tripl-ai on GitHub
</a>
</li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<article class="article">
<div class="wrapper">
<h1>Arc </h1>
<h2 id="what-is-arc">What is Arc?</h2>
<p>Arc is an <strong>opinionated</strong> framework for defining <strong>predictable</strong>, <strong>repeatable</strong> and <strong>manageable</strong> data transformation pipelines;</p>
<ul>
<li><strong>predictable</strong> in that data is used to define transformations - not code.</li>
<li><strong>repeatable</strong> in that if a job is executed multiple times it will produce the same result.</li>
<li><strong>manageable</strong> in that execution considerations and logging have been baked in from the start.</li>
</ul>
<h2 id="getting-started">Getting Started</h2>
<p><img src="https://arc.tripl.ai/img/arc-starter.png" alt="Notebook" /></p>
<p>Arc has an interactive <a href="https://jupyter.org/">Jupyter Notebook</a> extension to help with rapid development of jobs. Start by cloning <a href="https://github.com/tripl-ai/arc-starter">https://github.com/tripl-ai/arc-starter</a> and running through the <a href="https://arc.tripl.ai/tutorial/">tutorial</a>.</p>
<p>This extension is available at <a href="https://github.com/tripl-ai/arc-jupyter">https://github.com/tripl-ai/arc-jupyter</a>.</p>
<h2 id="principles">Principles</h2>
<p>Many of these principles have come from <a href="https://12factor.net/">12factor</a>:</p>
<ul>
<li><strong><a href="https://en.wikipedia.org/wiki/Single_responsibility_principle">single responsibility</a></strong> components/stages.</li>
<li><strong>stateless</strong> jobs where possible and use of <a href="https://en.wikipedia.org/wiki/Immutable_object">immutable</a> datasets.</li>
<li><strong>precise logging</strong> to allow management of jobs at scale.</li>
<li><strong>library dependencies</strong> are to be limited or avoided where possible.</li>
</ul>
<h2 id="not-just-for-data-engineers">Not just for data engineers</h2>
<p>The intent of the pipeline is to provide a simple way of creating Extract-Transform-Load (ETL) pipelines which are able to be maintained in production, and captures the answers to simple operational questions transparently to the user.</p>
<ul>
<li><strong>monitoring</strong>: is it working each time it’s run? and how much resource was consumed in creating it?</li>
<li><strong>devops</strong>: is packaged as a Docker image to allow rapid deployment on ephemeral compute.</li>
</ul>
<p>These concerns are supported at run time to ensure that as deployment grows in uses and complexity it does not become opaque and unmanageable.</p>
<h2 id="why-abstract-from-code">Why abstract from code?</h2>
<p>From experience a very high proportion of data pipelines perform very similar extract, transform and load actions on datasets. Unfortunately, whilst the desired outcomes are largely similar, the implementations are vastly varied resulting in higher maintenance costs, lower test-coverage and high levels of rework.</p>
<p>The intention of this project is to define and implement an <strong>opinionated</strong> standard approach for declaring data pipelines which is open and extensible. Abstraction from underlying code allows rapid deployment, a consistent way of defining transformation tasks (such as data typing) and allows abstraction of the pipeline definition from the pipeline execution (to support changing of the underlying execution engines) - see <a href="https://en.wikipedia.org/wiki/Declarative_programming">declarative programming</a>.</p>
<p>Currently it is tightly coupled to <a href="https://spark.apache.org">Apache Spark</a> due to its fault-tolerance, performance and solid API for standard data engineering tasks but the definitions are human and machine readable <a href="https://github.com/lightbend/config/blob/master/HOCON.md">HOCON</a> (a JSON derivative) allowing the transformation definitions to be implemented against future execution engines.</p>
<h2 id="why-sql-first">Why SQL first?</h2>
<p>SQL first (based on the Mobile First UX principle) is an approach where, if possible, transformations are done using Structured Query Language (SQL) as a preference. This is because SQL is a very good way of expressing standard data transformation intent in a <a href="https://en.wikipedia.org/wiki/Declarative_programming">declarative</a> way. SQL is so widely known and taught that finding people who are able to understand the business context and able to write basic SQL is much easier than finding a Scala developer who also understands the business context (for example).</p>
<p>Currently the <a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual">HIVE</a> dialect of SQL is supported as <a href="https://spark.apache.org/docs/latest/sql-programming-guide.html">Spark SQL</a> uses the same SQL dialect and has a lot of the same <a href="https://spark.apache.org/docs/latest/api/sql/index.html">functions</a> that would be expected from other SQL dialects. This could change in the future.</p>
<h2 id="example-pipeline">Example pipeline</h2>
<h3 id="logic">Logic</h3>
<p>This is an example of a fairly standard pipeline:</p>
<ol>
<li><p>First load a set of CSV files from an input directory. Separator is a comma and the file does not have a header.</p></li>
<li><p>Convert the data to the correct datatypes using metadata defined in a separate JSON.</p></li>
<li><p>Execute a SQL statement that will perform custom validation to ensure the data conversion in the previous step resulted in an acceptable data conversion error rate.</p></li>
<li><p>Calculate some aggregates using a SQL Transformation substituting the <code>${year}</code> variable with the value <code>2016</code>.</p></li>
<li><p>Write out the aggreate resultset to a Parquet target.</p></li>
</ol>
<h3 id="implementation">Implementation</h3>
<div class="highlight"><pre class="chroma"><code class="language-json" data-lang="json"><span class="p">{</span>
<span class="nt">"stages"</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">"type"</span><span class="p">:</span> <span class="s2">"DelimitedExtract"</span><span class="p">,</span>
<span class="nt">"name"</span><span class="p">:</span> <span class="s2">"extract data from green_tripdata/0"</span><span class="p">,</span>
<span class="nt">"environments"</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">"production"</span><span class="p">,</span>
<span class="s2">"test"</span>
<span class="p">],</span>
<span class="nt">"inputURI"</span><span class="p">:</span> <span class="s2">"hdfs://datalake/input/green_tripdata/0/*.csv"</span><span class="p">,</span>
<span class="nt">"outputView"</span><span class="p">:</span> <span class="s2">"green_tripdata0_raw"</span><span class="p">,</span>
<span class="nt">"persist"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="nt">"delimiter"</span><span class="p">:</span> <span class="s2">"Comma"</span><span class="p">,</span>
<span class="nt">"quote"</span><span class="p">:</span> <span class="s2">"DoubleQuote"</span><span class="p">,</span>
<span class="nt">"header"</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">"type"</span><span class="p">:</span> <span class="s2">"TypingTransform"</span><span class="p">,</span>
<span class="nt">"name"</span><span class="p">:</span> <span class="s2">"apply green_tripdata/0 data types"</span><span class="p">,</span>
<span class="nt">"environments"</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">"production"</span><span class="p">,</span>
<span class="s2">"test"</span>
<span class="p">],</span>
<span class="nt">"inputURI"</span><span class="p">:</span> <span class="s2">"hdfs://datalake/metadata/green_tripdata.json"</span><span class="p">,</span>
<span class="nt">"inputView"</span><span class="p">:</span> <span class="s2">"green_tripdata0_raw"</span><span class="p">,</span>
<span class="nt">"outputView"</span><span class="p">:</span> <span class="s2">"green_tripdata0"</span><span class="p">,</span>
<span class="nt">"persist"</span><span class="p">:</span> <span class="kc">true</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">"type"</span><span class="p">:</span> <span class="s2">"SQLValidate"</span><span class="p">,</span>
<span class="nt">"name"</span><span class="p">:</span> <span class="s2">"ensure no errors exist after data typing"</span><span class="p">,</span>
<span class="nt">"environments"</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">"production"</span><span class="p">,</span>
<span class="s2">"test"</span>
<span class="p">],</span>
<span class="nt">"inputURI"</span><span class="p">:</span> <span class="s2">"hdfs://datalake/sql/sqlvalidate_errors.sql"</span><span class="p">,</span>
<span class="nt">"sqlParams"</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">"table_name"</span><span class="p">:</span> <span class="s2">"green_tripdata0"</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">"type"</span><span class="p">:</span> <span class="s2">"SQLTransform"</span><span class="p">,</span>
<span class="nt">"name"</span><span class="p">:</span> <span class="s2">"merge *tripdata to create a full trips"</span><span class="p">,</span>
<span class="nt">"environments"</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">"production"</span><span class="p">,</span>
<span class="s2">"test"</span>
<span class="p">],</span>
<span class="nt">"inputURI"</span><span class="p">:</span> <span class="s2">"hdfs://datalake/sql/trips.sql"</span><span class="p">,</span>
<span class="nt">"outputView"</span><span class="p">:</span> <span class="s2">"trips"</span><span class="p">,</span>
<span class="nt">"persist"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
<span class="nt">"sqlParams"</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">"year"</span><span class="p">:</span> <span class="s2">"2016"</span>
<span class="p">}</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">"type"</span><span class="p">:</span> <span class="s2">"ParquetLoad"</span><span class="p">,</span>
<span class="nt">"name"</span><span class="p">:</span> <span class="s2">"write trips back to filesystem"</span><span class="p">,</span>
<span class="nt">"environments"</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">"production"</span><span class="p">,</span>
<span class="s2">"test"</span>
<span class="p">],</span>
<span class="nt">"inputView"</span><span class="p">:</span> <span class="s2">"trips"</span><span class="p">,</span>
<span class="nt">"outputURI"</span><span class="p">:</span> <span class="err">$</span><span class="p">{</span><span class="err">ETL_CONF_BASE_URL</span><span class="p">}</span><span class="s2">"/data/output/trips.parquet"</span><span class="p">,</span>
<span class="nt">"numPartitions"</span><span class="p">:</span> <span class="mi">100</span><span class="p">,</span>
<span class="nt">"partitionBy"</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">"vendor_id"</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span></code></pre></div>
<h2 id="contributing">Contributing</h2>
<p>If you have suggestions of additional components or find issues that you believe need fixing then please raise an issue. An issue with a test case is even more appreciated.</p>
<p>When you contribute code, you affirm that the contribution is your original work and that you license the work to the project under the project’s open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project’s open source license and warrant that you have the legal authority to do so.</p>
<h2 id="support">Support</h2>
<p>For questions around use (which are not clear from the documentation) post a new ‘issue’ in the <a href="https://github.com/tripl-ai/questions/issues">questions</a> repository. This repository acts as a forum where questions can be posted, discussed and searched.</p>
<p>For commercial support requests please <a href="mailto:contact@tripl.ai">contact us</a> via email.</p>
<h2 id="attribution">Attribution</h2>
<p>Thanks to the following projects:</p>
<ul>
<li><a href="https://spark.apache.org/">Apache Spark</a> for the underlying framework that has made this library possible.</li>
<li><a href="https://github.com/savoirtech/slf4j-json-logger">slf4j-json-logger</a> Copyright © 2016 Savoir Technologies released under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>. We have slightly altered their library to change the default logging format.</li>
<li><a href="https://github.com/Azure/azure-sqldb-spark">azure-sqldb-spark</a> for their Microsoft SQL Server bulkload driver. Currently included in /lib but will be pulled from Maven once available.</li>
<li><a href="https://github.com/toddwschneider/nyc-taxi-data">nyc-taxi-data</a> for preparing an easy to use set of real-world data for the tutorial.</li>
</ul>
<h2 id="license">License</h2>
<p>Arc is released under the <a href="https://opensource.org/licenses/MIT">MIT License</a>. See <a href="https://arc.tripl.ai/license">License</a> for full information.</p>
<aside class="copyright" role="note">
© 2019 Released under the MIT license
</aside>
<footer class="footer">
<nav class="pagination" aria-label="Footer">
<div class="previous">
</div>
<div class="next">
<a href="https://arc.tripl.ai/tutorial/" title="Tutorial">
<span class="direction">
Next
</span>
<div class="page">
<div class="stretch">
<div class="title">
Tutorial
</div>
</div>
<div class="button button-next" role="button" aria-label="Next">
<i class="icon icon-forward"></i>
</div>
</div>
</a>
</div>
</nav>
</footer>
</div>
</article>
<div class="results" role="status" aria-live="polite">
<div class="scrollable">
<div class="wrapper">
<div class="meta"></div>
<div class="list"></div>
</div>
</div>
</div>
</main>
<script>
var base_url = 'https:\/\/arc.tripl.ai\/';
var repo_id = 'tripl-ai\/arc';
</script>
<script src="https://arc.tripl.ai/javascripts/application.js"></script>
<script>
/* Add headers to scrollspy */
var headers = document.getElementsByTagName("h2");
var scrollspy = document.getElementById('scrollspy');
if(scrollspy) {
if(headers.length > 0) {
for(var i = 0; i < headers.length; i++) {
var li = document.createElement("li");
li.setAttribute("class", "anchor");
var a = document.createElement("a");
a.setAttribute("href", "#" + headers[i].id);
a.setAttribute("title", headers[i].innerHTML);
a.innerHTML = headers[i].innerHTML;
li.appendChild(a)
scrollspy.appendChild(li);
}
} else {
scrollspy.parentElement.removeChild(scrollspy)
}
/* Add permanent link next to the headers */
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
for(var i = 0; i < headers.length; i++) {
var a = document.createElement("a");
a.setAttribute("class", "headerlink");
a.setAttribute("href", "#" + headers[i].id);
a.setAttribute("title", "Permanent link")
a.innerHTML = "#";
headers[i].appendChild(a);
}
}
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/languages/scala.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>