Exercises, examples and other material relating to training module Y113. This topic is presented on public courses
Learning to program in Python,
Python Programming
Background
Data within a Python application can be held and referenced
many ways - in regular files, in XML, via a web server (such as
an HTML or RSS feed) and within a relational database. This
module looks at the two most commonly used databases in Python -
MySQL and SQLite, which both use the structured query language,
but use different internal models. In then shows how those
databases are used from within a Python program, how other databases
(which usually follow a similar model) may be used, and how
the databases are wrapped if you're using a web framework such as
Django.
| Articles and tips on this subject | updated |
| 4086 | Cacheing class for Python - using a local SQLite database as a key/value store Question from Tom: What did you have for lunch yesterday?
Answer: A Sandwich, a piece of cake and some fruit.
Question from Dick: What did you have for lunch yesterday?
Answer: A Sandwich, a piece of cake and some fruit.
Question from Harry: What did you have for lunch yesterday?
Answer: A Sandwich, ... | 2013-05-18 |
| 4024 | SQL databases from Python - an SQLite example There's a new example of relational database use in Python [here] on our site - from the Python course I ran last week. If you cut and paste the script onto your system, it should run with little fuss (and without needing a separate database engine) as it uses sqlite - the built in SQL database - as ... | 2013-03-02 |
| 3139 | Steering our Python courses towards wxPython, SQLite and Django With our modular courses that we write ourselves, we've well placed to move forward with technology; more often than not, what's needed is a series of gentle changes, adding in the occasional module for private courses where a particular new subject is needed, with it being introduced into public courses ... | 2011-01-21 |
| 3136 | A framework with python - Django - first steps What is Django and what do I need to be able to use it?
Django is a framework - a tool that lets you create, customise, run and maintain web sites in which the data is stored in database tables. It uses the DRY (Don't Repeat Yourself) philospohy of design - quite the opposite of early web sites, where ... | 2011-01-19 (longest) |
| 2790 | Joining a MySQL table from within a Python program Python is a big subject.
MySQL is a big subject.
Yet the two fin so well together that they can be firmly linked, and work well together, using the tiniest drops of glue.
I've provided examples here before, but in answer to a request from a recent delegate, I've just added a fresh example onto our ... | 2010-06-02 |
| 2786 | Factory methods and SqLite in use in a Python teaching example I've just uploaded a neat little example - [here] from last week's Python course - it's amazing what you can do in a very few lines of code.
The application scenario is that we have a database of customers - some are residents at our hotel and others are delegates on our courses. Being mercenary folks, ... | 2010-06-02 |
| 2746 | Model - View - Controller demo, Sqlite - Python 3 - Qt4 The Model - View - Controller approach to application design keeps the Graphic User Interface (the view) separate from the database (the model), with the controller in between the two, describing how the data is displayed, and how changes to the data are saved away in the database. By separating the ... | 2010-04-29 |
| 2745 | Connecting Python to sqlite and MySQL databases For developing a Python application, and for light use, the SQLite database may be a good choice ... but then you may want to be able to expand the system to use a central database with a more classic server such as MySQL at a later date.
Using Polymorphism in Python, and with a careful choice of which ... | 2010-04-28 |
2282
Examples from our training material
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
http://www.training-notes.co.uk.
Topics covered in this module
A built in database - SQLite.
Connection to a database server.
Drivers for MySQL and other databases.
The basic principles of databases.
Using SQLite from Python.
Using MySQL and other databses from Python.
Checking your tables from the command line.
Databases in Django.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.