-
Notifications
You must be signed in to change notification settings - Fork 0
/
data-management-lsst.html
493 lines (452 loc) · 33.2 KB
/
data-management-lsst.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
<!DOCTYPE html>
<html lang="en" itemscope itemtype="http://schema.org/Person">
<head>
<meta charset="utf-8" />
<!-- Site Meta Data -->
<title>Data Management @ LSST</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />
<meta name="author" content="Dongming Jin" />
<link rel="shortcut icon" href="/images/favicon.ico" />
<!-- schema.org -->
<meta itemprop="name" content="Domi's Universe" />
<meta itemprop="image" content="" />
<meta itemprop="description" content="" />
<link
href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700"
rel="stylesheet"
type="text/css"
/>
<!-- Style Meta Data -->
<link rel="stylesheet" href="/theme/css/style.css" type="text/css" />
<link rel="stylesheet" href="/theme/css/pygments.css" type="text/css" />
<!-- Feed Meta Data -->
<link
href="/feeds/all.atom.xml"
type="application/atom+xml"
rel="alternate"
title="Domi's Universe ATOM Feed"
/>
<!-- Twitter Feed -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="domij_info" />
<meta name="twitter:image" content="" />
<meta name="twitter:creator" content="domij_info" />
<meta name="twitter:url" content="/data-management-lsst.html" />
<meta
name="twitter:title"
content="Domi's Universe ~ Data Management @ LSST"
/>
<meta
name="twitter:description"
content="4/24/17 SQLite with python Basic operation syntax import sqlite3 conn = sqlite3.connect("reintro.db") cur = conn.cursor() // creat cursor for operations cur.execute("""create table PetInfo( Name text, Species text, Age tinyint, FavoriteFood text )""") cur.fetchall() // display the cursor conn.commit() // commit change to database cur.execute("""drop …"
/>
<meta
name="twitter:image"
content="https://www.dropbox.com/s/c8tutz6p5f9gvmj/Screenshot%202017-04-24%2011.29.49.png?raw=1"
/>
<!-- Facebook Meta Data -->
<meta
property="og:title"
content="Domi's Universe ~ Data Management @ LSST"
/>
<meta
property="og:description"
content="4/24/17 SQLite with python Basic operation syntax import sqlite3 conn = sqlite3.connect("reintro.db") cur = conn.cursor() // creat cursor for operations cur.execute("""create table PetInfo( Name text, Species text, Age tinyint, FavoriteFood text )""") cur.fetchall() // display the cursor conn.commit() // commit change to database cur.execute("""drop …"
/>
<meta
property="og:image"
content="https://www.dropbox.com/s/c8tutz6p5f9gvmj/Screenshot%202017-04-24%2011.29.49.png?raw=1"
/>
</head>
<body>
<!-- Sidebar -->
<aside>
<center>
<a href="/pages/about-me.html">
<img
alt="Photograph"
style="width: 120px; height: 120px; border-radius: 60px; border: 0"
src="/images/Photo.JPG"
/>
</a>
</center>
<br />
<!-- <h1>Dongming Jin</h1> -->
<p>
sci-fi mind, engineer hand
<br />
<br />
<a
class="twitter-follow-button"
href="https://twitter.com/domij_info"
data-show-count="false"
data-lang="en"
>
Follow @twitterdev
</a>
<script type="text/javascript">
window.twttr = (function (d, s, id) {
var t,
js,
fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
return (
window.twttr ||
(t = {
_e: [],
ready: function (f) {
t._e.push(f);
},
})
);
})(document, "script", "twitter-wjs");
</script>
</p>
<nav class="nav">
<ul class="list-bare">
<li>
<a class="nav__link" href="/">Blogs</a>
</li>
<li>
<a class="nav__link" href="/pages/about-me.html">About Me</a>
</li>
<li>
<a class="nav__link" href="/pages/footprint.html">Footprint</a>
</li>
<li>
<a class="nav__link" href="/pages/research.html">Research</a>
</li>
<li>
<a
class="nav__link"
href="/pages/zhe-li-xiao-zhong-hai-wai-xiao-you.html"
>浙里萧中-海外校友</a
>
</li>
</ul>
</nav>
<p class="social">
<a href="https://www.linkedin.com/in/domijin" target="_blank"
><img src="/theme/images/icons/linkedin.png"
/></a>
<a href="https://github.com/domijin" target="_blank"
><img src="/theme/images/icons/github.png"
/></a>
<a href="/feeds/all.atom.xml" rel="alternate">
<img src="/theme/images/icons/rss.png"
/></a>
</p>
<h2>Categories</h2>
<ul class="navbar">
<li>
<a href="/category/articles.html">articles</a>
</li>
<li>
<a href="/category/cheatsheets.html">cheatsheets</a>
</li>
<li>
<a href="/category/maker-notes.html">maker-notes</a>
</li>
<li class="active">
<a href="/category/study-notes.html">study-notes</a>
</li>
</ul>
</aside>
<!-- Content -->
<article>
<section id="content">
<article>
<h2 class="post_title post_detail">
<a
href="/data-management-lsst.html"
rel="bookmark"
title="Permalink to Data Management @ LSST"
>Data Management @ LSST</a
>
</h2>
<div class="entry-content blog-post">
<p>4/24/17</p>
<h3 id="sqlite-with-python">SQLite with python</h3>
<p>Basic operation syntax</p>
<div class="highlight">
<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlite3</span>
<span class="n">conn</span> <span class="o">=</span> <span class="n">sqlite3</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s2">"reintro.db"</span><span class="p">)</span>
<span class="n">cur</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span> <span class="o">//</span> <span class="n">creat</span> <span class="n">cursor</span> <span class="k">for</span> <span class="n">operations</span>
<span class="n">cur</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">"""create table PetInfo(</span>
<span class="s2"> Name text, </span>
<span class="s2"> Species text,</span>
<span class="s2"> Age tinyint,</span>
<span class="s2"> FavoriteFood text</span>
<span class="s2"> )"""</span><span class="p">)</span>
<span class="n">cur</span><span class="o">.</span><span class="n">fetchall</span><span class="p">()</span> <span class="o">//</span> <span class="n">display</span> <span class="n">the</span> <span class="n">cursor</span>
<span class="n">conn</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span> <span class="o">//</span> <span class="n">commit</span> <span class="n">change</span> <span class="n">to</span> <span class="n">database</span>
<span class="n">cur</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">"""drop table if exists xxx"""</span><span class="p">)</span> <span class="c1"># drop the table if is already exists</span>
</code></pre>
</div>
<p>SDSS API</p>
<div class="highlight">
<pre><span></span><code><span class="kn">from</span> <span class="nn">astroquery.sdss</span> <span class="kn">import</span> <span class="n">SDSS</span>
<span class="n">SDSS</span><span class="o">.</span><span class="n">query_sql</span><span class="p">(</span><span class="s2">"""select top 20 * from PhotoObjAll"""</span><span class="p">)</span>
</code></pre>
</div>
<p>
demonstration of Join:
<img
src="https://www.dropbox.com/s/c8tutz6p5f9gvmj/Screenshot%202017-04-24%2011.29.49.png?raw=1"
/>
</p>
<hr />
<p>4/25/17</p>
<h2 id="sql-byyusra-alsayyad">SQL byYusra AlSayyad</h2>
<p>Data Management: building database, storing data</p>
<ul>
<li>SQL database</li>
<li>Relational Algebra, not good for graph structure</li>
<li>combined -> pandas by Wes McKinney</li>
<li>TOPCAT: Relational database with uncertainty</li>
<li>Indexing: optimize data extracture and slicing</li>
<li>
hierarchical triangular mesh, reduce 2D to 1D for GIS indexing
</li>
</ul>
<p>SQL examples for inspiration</p>
<div class="highlight">
<pre><span></span><code><span class="k">CREATE</span><span class="w"> </span><span class="k">database</span><span class="w"> </span><span class="n">mysql_demo</span><span class="p">;</span>
<span class="n">use</span><span class="w"> </span><span class="n">mysql_demo</span><span class="p">;</span>
<span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">Person</span><span class="w"> </span><span class="p">(</span>
<span class="w"> </span><span class="n">personId</span><span class="w"> </span><span class="nb">int</span><span class="p">,</span>
<span class="w"> </span><span class="n">firstName</span><span class="w"> </span><span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">),</span>
<span class="w"> </span><span class="n">lastName</span><span class="w"> </span><span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">),</span>
<span class="w"> </span><span class="n">phoneNumber</span><span class="w"> </span><span class="nb">char</span><span class="p">(</span><span class="mi">10</span><span class="p">));</span>
<span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">Publication</span><span class="w"> </span><span class="p">(</span>
<span class="w"> </span><span class="n">pubId</span><span class="w"> </span><span class="nb">int</span><span class="p">,</span>
<span class="w"> </span><span class="n">title</span><span class="w"> </span><span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">),</span>
<span class="w"> </span><span class="n">journalName</span><span class="w"> </span><span class="nb">varchar</span><span class="p">(</span><span class="mi">255</span><span class="p">));</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">Person</span><span class="w"> </span><span class="k">VALUES</span><span class="w"> </span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'Cameron'</span><span class="p">,</span><span class="w"> </span><span class="s1">'Hummels'</span><span class="p">,</span><span class="w"> </span><span class="s1">'1234567890'</span><span class="p">);</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">Person</span><span class="w"> </span><span class="k">VALUES</span><span class="w"> </span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="s1">'Y'</span><span class="p">,</span><span class="w"> </span><span class="s1">'A'</span><span class="p">,</span><span class="w"> </span><span class="s1">'1234567890'</span><span class="p">);</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">Publication</span><span class="w"> </span><span class="k">VALUES</span><span class="w"> </span><span class="p">(</span><span class="mi">101</span><span class="p">,</span><span class="w"> </span><span class="s1">'Stuff about stars'</span><span class="p">,</span><span class="w"> </span><span class="s1">'Apj'</span><span class="p">);</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">Publication</span><span class="w"> </span><span class="k">VALUES</span><span class="w"> </span><span class="p">(</span><span class="mi">102</span><span class="p">,</span><span class="w"> </span><span class="s1">'Stuff about galaxies'</span><span class="p">,</span><span class="w"> </span><span class="s1">'Apj'</span><span class="p">);</span>
<span class="k">show</span><span class="w"> </span><span class="n">tables</span><span class="p">;</span>
<span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">Authorship</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="o">!</span><span class="w"> </span><span class="n">relational</span><span class="w"> </span><span class="n">dababase</span>
<span class="w"> </span><span class="n">personId</span><span class="w"> </span><span class="nb">int</span><span class="p">,</span>
<span class="w"> </span><span class="n">pubId</span><span class="w"> </span><span class="nb">int</span><span class="p">);</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">Authorship</span><span class="w"> </span><span class="n">VALUE</span><span class="w"> </span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">101</span><span class="p">);</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">Authorship</span><span class="w"> </span><span class="n">VALUE</span><span class="w"> </span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">102</span><span class="p">);</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">Authorship</span><span class="w"> </span><span class="n">VALUE</span><span class="w"> </span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">101</span><span class="p">);</span>
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">Authorship</span><span class="w"> </span><span class="n">VALUE</span><span class="w"> </span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">102</span><span class="p">);</span>
<span class="k">SELECT</span><span class="w"> </span><span class="n">pub</span><span class="p">.</span><span class="o">*</span><span class="p">,</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="o">*</span>
<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">publication</span><span class="w"> </span><span class="n">pub</span><span class="w"> </span>
<span class="w"> </span><span class="k">INNER</span><span class="w"> </span><span class="k">JOIN</span><span class="w"> </span><span class="n">Authorship</span><span class="w"> </span><span class="n">a</span>
<span class="w"> </span><span class="k">on</span><span class="w"> </span><span class="n">a</span><span class="p">.</span><span class="n">pubId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">pub</span><span class="p">.</span><span class="n">pubId</span>
<span class="w"> </span><span class="k">INNER</span><span class="w"> </span><span class="k">JOIN</span><span class="w"> </span><span class="n">Person</span><span class="w"> </span><span class="n">p</span>
<span class="w"> </span><span class="k">on</span><span class="w"> </span><span class="n">a</span><span class="p">.</span><span class="n">personId</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">personId</span>
<span class="k">CREATE</span><span class="w"> </span><span class="k">INDEX</span><span class="w"> </span><span class="k">key</span><span class="w"> </span><span class="k">On</span><span class="w"> </span><span class="k">table</span>
<span class="k">SELECT</span><span class="w"> </span><span class="n">TOP</span><span class="w"> </span><span class="mi">10</span>
<span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">objid</span><span class="p">,</span><span class="n">p</span><span class="p">.</span><span class="n">ra</span><span class="p">,</span><span class="n">p</span><span class="p">.</span><span class="nb">dec</span><span class="p">,</span><span class="n">p</span><span class="p">.</span><span class="n">u</span><span class="p">,</span><span class="n">p</span><span class="p">.</span><span class="k">g</span><span class="p">,</span><span class="n">p</span><span class="p">.</span><span class="n">r</span><span class="p">,</span><span class="n">p</span><span class="p">.</span><span class="n">i</span><span class="p">,</span><span class="n">p</span><span class="p">.</span><span class="n">z</span><span class="p">,</span>
<span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">run</span><span class="p">,</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">rerun</span><span class="p">,</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">camcol</span><span class="p">,</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">field</span><span class="p">,</span>
<span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">specobjid</span><span class="p">,</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="k">class</span><span class="p">,</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">z</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">redshift</span><span class="p">,</span>
<span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">plate</span><span class="p">,</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">mjd</span><span class="p">,</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">fiberid</span>
<span class="k">FROM</span><span class="w"> </span><span class="n">PhotoObj</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">p</span>
<span class="w"> </span><span class="k">JOIN</span><span class="w"> </span><span class="n">SpecObj</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">s</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">bestobjid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">objid</span>
<span class="k">WHERE</span><span class="w"> </span>
<span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">u</span><span class="w"> </span><span class="k">BETWEEN</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="mi">19</span><span class="p">.</span><span class="mi">6</span>
<span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="k">g</span><span class="w"> </span><span class="k">BETWEEN</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="mi">20</span>
<span class="k">SELECT</span><span class="w"> </span><span class="n">top</span><span class="w"> </span><span class="mi">10</span><span class="w"> </span><span class="o">*</span><span class="w"> </span>
<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">photoobjall</span><span class="w"> </span><span class="n">p</span><span class="w"> </span>
<span class="w"> </span><span class="k">inner</span><span class="w"> </span><span class="k">join</span><span class="w"> </span><span class="n">ROSAT</span><span class="w"> </span><span class="n">r</span><span class="w"> </span>
<span class="w"> </span><span class="k">on</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">objid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">r</span><span class="p">.</span><span class="n">objid</span>
<span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="p">(</span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_u</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_g</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_r</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_i</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_z</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">10000</span><span class="p">)</span><span class="w"> </span>
<span class="w"> </span><span class="k">and</span><span class="w"> </span><span class="p">(</span><span class="n">p</span><span class="p">.</span><span class="k">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">3</span><span class="p">)</span><span class="w"> </span>
<span class="k">SELECT</span><span class="w"> </span><span class="n">pr</span><span class="p">.</span><span class="o">*</span>
<span class="k">FROM</span>
<span class="w"> </span><span class="p">(</span><span class="k">SELECT</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="o">*</span><span class="w"> </span>
<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">photoobjall</span><span class="w"> </span><span class="n">p</span><span class="w"> </span><span class="k">JOIN</span><span class="w"> </span><span class="n">rosat</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">objid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">r</span><span class="p">.</span><span class="n">objid</span>
<span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="p">(</span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_u</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_g</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_r</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_i</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">p</span><span class="p">.</span><span class="n">cModelFlux_z</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">10000</span><span class="p">)</span><span class="w"> </span>
<span class="w"> </span><span class="k">and</span><span class="w"> </span><span class="p">(</span><span class="n">p</span><span class="p">.</span><span class="k">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">3</span><span class="p">)</span>
<span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">pr</span>
<span class="w"> </span><span class="k">LEFT</span><span class="w"> </span><span class="k">JOIN</span><span class="w"> </span><span class="n">specobjall</span><span class="w"> </span><span class="n">s</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">bestobjid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">pr</span><span class="p">.</span><span class="n">objid</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">bestobjid</span><span class="w"> </span><span class="k">is</span><span class="w"> </span><span class="k">null</span>
<span class="k">GROUP</span><span class="w"> </span><span class="k">BY</span>
<span class="k">ORDER</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="k">ASC</span><span class="o">/</span><span class="nb">DEC</span>
</code></pre>
</div>
<hr />
<p>4/26/17</p>
<h2 id="data-management-extracting-data">
Data Management: extracting data
</h2>
<blockquote>
<p>Scaling up -> scaling out</p>
</blockquote>
<p>Hardware Architecture</p>
<ul>
<li>Parallel RDMS Architecture: shared nothing</li>
<li>
Partitioning: spatical indexing
<ul>
<li>fast extracting regional data in high dimension</li>
<li>
random distribute data based on hash table to balance load
</li>
</ul>
</li>
<li>Shared scanning</li>
<li>Fault tolerance</li>
</ul>
<p>Software</p>
<ul>
<li>Spark, HDFS solution</li>
<li>Hadoop Distributed Files System, HDFS</li>
<li>MapReduce</li>
<li>Relation (shcema)</li>
<li>Indexing</li>
<li>Eventually -> <code>database</code></li>
<li>NoSQL: not only SQL, non-relational (no schema)</li>
<li>MongoDB</li>
<li>DynamoDB</li>
<li>...</li>
<li>Aggregation-oriented database</li>
<li>pros: same type of aggregated data</li>
<li>cons: hard to slice and dice</li>
</ul>
<p><a href="https://github.com/lsst/qserv">LSST QSERV</a></p>
<hr />
<p>10/19/17</p>
<p>
<strong>Resources</strong> *
<a href="https://sqlnotebook.com/index.html">SQL notebook</a> *
<a
href="https://www.khanacademy.org/computing/computer-programming/sql/more-advanced-sql-queries/p/calculating-results-with-case"
>SQL course on KhanAcademy</a
>
</p>
</div>
<div class="post_list">
<span class="published" title="2017-10-19T00:00:00-05:00">
Published: Thu 19 October 2017.
</span>
<span> By </span>
<a href="/pages/about-me.html">Dongming Jin</a>
<span> in </span>
<span class="post_category"
><a
href="/category/study-notes.html"
rel="bookmark"
title="Permalink to study-notes"
>
#study-notes.
</a></span
>
<div class="entry-social">
<span class="twitter"
><a
target="_blank"
rel="nofollow"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;"
title="Twitter"
href="https://twitter.com/share?url=/data-management-lsst.html&text=Data Management @ LSST&via=domij_info"
><img src="/theme/images/icons/twitter-s.png" /></a
></span>
<span class="gplus"
><a
target="_blank"
title="Google +"
href="https://plus.google.com/share?url=/data-management-lsst.html&hl=fr"
rel="nofollow"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;"
><img src="/theme/images/icons/google-s.png" /></a
></span>
<span class="facebook"
><a
target="_blank"
title="Facebook"
rel="nofollow"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700');return false;"
href="https://www.facebook.com/sharer.php?u=/data-management-lsst.html&t=Data Management @ LSST"
><img src="/theme/images/icons/facebook-s.png" /></a
></span>
<a
target="_blank"
title="Linkedin"
href="https://www.linkedin.com/shareArticle?mini=true&url=/data-management-lsst.html&title=Data Management @ LSST"
rel="nofollow"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;"
><img src="/theme/images/icons/linkedin-s.png"
/></a>
<span class="mail"
><a
href="mailto:?subject=Data Management @ LSST&body=Checkout this article about [Data Management @ LSST] written byDongming Jin. /data-management-lsst.html"
title="Share by Email"
target="_blank"
><img src="/theme/images/icons/mail-s.png" /></a
></span>
</div>
</div>
<div class="comments">
<h2>Comments !</h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_identifier = "data-management-lsst.html";
(function () {
var dsq = document.createElement("script");
dsq.type = "text/javascript";
dsq.async = true;
dsq.src = "https://domij.disqus.com/embed.js";
(
document.getElementsByTagName("head")[0] ||
document.getElementsByTagName("body")[0]
).appendChild(dsq);
})();
</script>
</div>
</article>
</section>
</article>
<!-- Footer -->
<footer>
<p>
© Copyright 2018 <a href="mailto:[email protected]"> Dongming Jin</a> |
<a
href="https://www.freeprivacypolicy.com/privacy/view/bc11c24cc8faf2a9a506ffd5aa40278d"
>Privacy Policy</a
>
| Powered by <a href="http://getpelican.com/">Pelican</a> and
<a href="https://github.com/parbhat/pelican-blue">Pelican-Blue</a>.
</p>
</footer>
<!-- Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-121123490-1"]);
_gaq.push(["_trackPageview"]);
(function () {
var ga = document.createElement("script");
ga.type = "text/javascript";
ga.async = true;
ga.src =
("https:" == document.location.protocol
? "https://ssl"
: "http://www") + ".google-analytics.com/ga.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- Google tag (gtag.js) -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-MWRTXBB8DD"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "G-MWRTXBB8DD");
</script>
</body>
</html>