-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathintro.html
More file actions
98 lines (72 loc) · 6.97 KB
/
intro.html
File metadata and controls
98 lines (72 loc) · 6.97 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://www.owencampbell.me.uk/images/favicon/favicon.ico" rel="icon">
<title>SQL for Python Programmers</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link href="https://www.owencampbell.me.uk/theme/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="/sql_python_tutorial/static/styles.css">
</head>
<body>
<div class="fixed-top">
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">SQL for Python Programmers</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarContent">
<div class="navbar-nav">
<a class="nav-item nav-link" href="/sql_python_tutorial/"><i class="fa fa-home fa-fw" aria-hidden="true" title="home"></i> Home</a>
<a class="nav-item nav-link mr-auto" href="/sql_python_tutorial/chapters/"><i class="fa fa-book fa-fw" aria-hidden="true" title="contents"></i> Contents</a>
<a class="nav-item nav-link" href="/sql_python_tutorial/pages/intro.html"><i class="fa fa-info-circle fa-fw" aria-hidden="true" title="introduction"></i> Introduction</a>
<a class="nav-item nav-link" href="/sql_python_tutorial/pages/howto.html"><i class="fa fa-gears fa-fw" aria-hidden="true" title="how to"></i> How To</span></a>
<a class="nav-item nav-link" href="/sql_python_tutorial/pages/primer.html"><i class="fa fa-database fa-fw" aria-hidden="true" title="primer"></i> Primer</a>
</div>
<div class="navbar-nav ml-auto">
<a class="btn btn-link btn-lg" href="https://www.linkedin.com/in/owencampbell" title="linkedin"><i class="fa fa-linkedin" aria-hidden="true"></i></a>
<a class="btn btn-link btn-lg" href="http://github.com/meatballs" title="github"><i class="fa fa-github" aria-hidden="true"></i></a>
</div>
</div>
</nav>
</div>
<main role="main" class="container">
<h1><i class="fa fa-info-circle" aria-hidden="true"></i> Introduction</h1>
<h2>Welcome</h2>
<p>Welcome to the SQL for Python Programmers tutorial!</p>
<p>This tutorial is designed to help Python programmers (of any level of experience) who have little or no knowledge of relational databases and SQL.</p>
<p>If you are a database administrator or an SQL expert, you may find some tricks for how to use SQL within Python, but if you are looking for material on advanced SQL, this is probably not the place to find it.</p>
<h2>Why Learn SQL?</h2>
<p>It is perfectly possible to use a relational database in your Python programs without learning any SQL at all. There are several excellent Object Relational Mapper (ORM) libraries that will auto-generate and execute SQL for you from pure Python code.
<p>However, a modern relational database is an extremely powerful tool and, if you want to use it to its full capability, you'll need to learn its language: SQL</p>
<p>A good analogy is Javascript. It's perfectly possible to write web applications without learning any Javascript at all. Again, there are libraries that will handle things for you. But if you want to take full advantage of a modern browser, you really need to learn the languages it uses: HTML5, Javascript and CSS.</p>
<p>Even if you mostly continue to use an ORM, a knowledge of what it's doing for you can be invaluable if you ever want to intervene and do things slightly differently.</p>
<p>There are also situations where using SQL is far more efficient than Python. If your database resides on a server and your Python code executes on a different machine, any data you want to process has to be sent across some kind of network connection. Any filtering or aggregation that's needed is far better executed on the database server so that only the required data is sent across the network. If your process is to extract some data, manipulate it in some way and send it straight back to the database for persistence, that will almost always be more efficient if you issue SQL statements to the database server than bringing the data across the network and sending the results back again.</p>
<h2>Knowledge You Will Need</h2>
<p>The tutorial assumes no knowledge of SQL at all and starts from the very basics. You will need some understanding of Python code although most of the content is suitable for Python beginners too. Where the Python code strays into more advanced concepts, there are links to the relevant documentation for you to follow.</p>
<p>If you choose to use your own computer to run the tutorial code (details on those options are described in the <a href="/sql_python_tutorial/pages/howto">How To</a>), you will need to be comfortable using a command line terminal.</p>
<h2>How To Contribute</h2>
<p>The code for this tutorial is hosted at <a href="https://github.com/meatballs/sql_python_tutorial">Github</a> with a <a href="https://github.com/meatballs/sql_python_notebooks">separate repository</a> for the Jupyter notebooks. Please feel free to report any <a href="https://github.com/meatballs/sql_python_tutorial/issues">issues</a> that you find or to submit a <a href="https://github.com/meatballs/sql_python_tutorial/pulls">pull request</a> for any changes you would like to suggest.</p>
<h2>About the Author</h2>
<p>Owen Campbell is a freelance Software Engineer with over 30 years' experience.</p>
<p>He is a founding trustee of <a href="http://uk.python.org/">The UK Python Association</a> and one of the <a href="http://pyconuk.org/">PyCon UK</a> organisers.</p>
<p>If you would like to hire him to work with your own organisation, use the social media links at the top of this page or this <a href=http://www.owencampbell.me.uk/pages/contact.html">contact form</a> to get in touch.</p>
</main>
<footer class="footer d-none d-md-block">
<div class="container">
<span class="text-muted">
<p class="small">
This tutorial was inspired by a talk given by <a href="https://twitter.com/waveform80">Dave Jones</a> at <a href="https://twitter.com/pythonnw">Python North West</a>.
The flights database, and much of the SQL code, is taken, with grateful thanks,
from the <a href="https://waveform.org.uk/presentations/sql">slides</a> and
<a href="https://github.com/waveform80/presentations">source code</a> for that talk.
<br/>
Many thanks also to <a href="https://vknight.org/">Dr. Vincent Knight</a> of <a href="http://www.cardiff.ac.uk">Cardiff University</a> for the use of his
<a href="https://vknight.org/gt/">Game Theory Course Notes</a> and their <a href="https://github.com/drvinceknight/gt">source code</a>.
</p>
</span>
</div>
</footer>
</body>
</html>