~cjwatson/storm/psycopg-2.5

332 by Jamu Kakar
- The README file now includes information about Storm's license,
1
Storm is an Object Relational Mapper for Python developed at
2
Canonical.  API docs, a manual, and a tutorial are available from:
173 by Christopher Armstrong
add a README file describing how to run the tests [trivial]
3
4
http://storm.canonical.com/
5
332 by Jamu Kakar
- The README file now includes information about Storm's license,
6
7
Introduction
8
============
9
10
The project was in development for more than a year for use in
11
Canonical projects such as Launchpad and Landscape before being
12
released as free software on July 9th, 2007.
13
14
Design:
15
16
 * Clean and lightweight API offers a short learning curve and
17
   long-term maintainability.
18
 * Storm is developed in a test-driven manner. An untested line of
19
   code is considered a bug.
20
 * Storm needs no special class constructors, nor imperative base
21
   classes.
22
 * Storm is well designed (different classes have very clear
23
   boundaries, with small and clean public APIs).
24
 * Designed from day one to work both with thin relational
25
   databases, such as SQLite, and big iron systems like PostgreSQL
26
   and MySQL.
27
 * Storm is easy to debug, since its code is written with a KISS
28
   principle, and thus is easy to understand.
29
 * Designed from day one to work both at the low end, with trivial
30
   small databases, and the high end, with applications accessing
31
   billion row tables and committing to multiple database backends.
32
 * It's very easy to write and support backends for Storm (current
33
   backends have around 100 lines of code).
34
35
Features:
36
37
 * Storm is fast.
38
 * Storm lets you efficiently access and update large datasets by
39
   allowing you to formulate complex queries spanning multiple
40
   tables using Python.
41
 * Storm allows you to fallback to SQL if needed (or if you just
42
   prefer), allowing you to mix "old school" code and ORM code
43
 * Storm handles composed primary keys with ease (no need for
44
   surrogate keys).
45
 * Storm doesn't do schema management, and as a result you're free
46
   to manage the schema as wanted, and creating classes that work
47
   with Storm is clean and simple.
48
 * Storm works very well connecting to several databases and using
49
   the same Python types (or different ones) with all of them.
50
 * Storm can handle obj.attr = <A SQL expression> assignments, when
51
   that's really needed (the expression is executed at INSERT/UPDATE
52
   time).
53
 * Storm handles relationships between objects even before they were
54
   added to a database.
55
 * Storm works well with existing database schemas.
56
 * Storm will flush changes to the database automatically when
57
   needed, so that queries made affect recently modified objects.
58
59
60
License
61
=======
62
63
Copyright (C) 2006-2009 Canonical, Ltd.  All contributions must have
64
copyright assigned to Canonical.
65
66
This library is free software; you can redistribute it and/or
67
modify it under the terms of the GNU Lesser General Public
68
License as published by the Free Software Foundation; either
69
version 2.1 of the License, or (at your option) any later version.
70
71
This library is distributed in the hope that it will be useful,
72
but WITHOUT ANY WARRANTY; without even the implied warranty of
73
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
74
Lesser General Public License for more details.
75
76
You should have received a copy of the GNU Lesser General Public
77
License along with this library; if not, write to the Free Software
78
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
79
02110-1301 USA
80
81
On Ubuntu systems, the complete text of the GNU Lesser General
82
Public Version 2.1 License is in /usr/share/common-licenses/LGPL-2.1
83
84
85
Developing Storm
86
================
87
424.2.10 by David Britton
Adding README note about the dev scripts, non-interactive to ubuntu-deps
88
SHORT VERSION:  If you are running ubuntu, or probably debian, the
89
following should work.  If not, and for reference, the long version
90
is below.
91
92
 $ dev/ubuntu-deps
93
 $ make develop
94
 $ dev/db-setup
95
 $ make check
96
97
LONG VERSION:
98
332 by Jamu Kakar
- The README file now includes information about Storm's license,
99
The following instructions describe the procedure for setting up a
100
development environment and running the test suite.
101
102
Installing dependencies
103
-----------------------
104
105
The following instructions assume that you're using Ubuntu.  The
106
same procedure will probably work without changes on a Debian system
107
and with minimal changes on a non-Debian-based linux distribution.
108
In order to run the test suite, and exercise all supported backends,
415.2.3 by Gavin Panella
Revert r417; MySQLdb-python is not reliably installable from PyPI.
109
you will need to install MySQL and PostgreSQL, along with the
110
related Python database drivers:
332 by Jamu Kakar
- The README file now includes information about Storm's license,
111
415.2.3 by Gavin Panella
Revert r417; MySQLdb-python is not reliably installable from PyPI.
112
 $ sudo apt-get install \
113
       python-mysqldb mysql-server \
415.1.33 by Gavin Panella
Merged go-setuptools into oneiric-admin-shutdown-bug-871596, resolving conflicts.
114
       postgresql pgbouncer \
115
       build-essential
332 by Jamu Kakar
- The README file now includes information about Storm's license,
116
117
These will take a few minutes to download (its a bit under 200MB all
118
together).  Once the download is complete, a screen called
119
"configuring mysql-server-5.0" will be shown.  When asked for a
120
password for the root user leave the field blank and hit enter to
121
continue.  This is not a recommended setting for a production
122
server, but makes life easier on a development machine.  You may be
123
asked to enter a password multiple times.  Leave it blank in each
124
case.
125
415.1.19 by Gavin Panella
Go completely over to the Dark, ahem, setuptools side.
126
The Python dependencies for running tests can mostly be installed with
127
apt-get:
128
415.1.25 by Gavin Panella
Document make develop in README.
129
 $ apt-get install \
415.1.33 by Gavin Panella
Merged go-setuptools into oneiric-admin-shutdown-bug-871596, resolving conflicts.
130
       python-django python-fixtures python-psycopg2 \
415.1.27 by Gavin Panella
Revert previous revision.
131
       python-testresources python-transaction python-twisted \
132
       python-zope.component python-zope.security
133
134
Two modules - pgbouncer and timeline - are not yet packaged in
135
Ubuntu. These can be installed from PyPI:
136
137
  http://pypi.python.org/pypi/pgbouncer
138
  http://pypi.python.org/pypi/timeline
415.1.19 by Gavin Panella
Go completely over to the Dark, ahem, setuptools side.
139
415.1.25 by Gavin Panella
Document make develop in README.
140
Alternatively, dependencies can be downloaded as eggs into the current
141
directory with:
142
143
 $ make develop
144
145
This ensures that all dependencies are available, downloading from
146
PyPI as appropriate.
415.1.9 by Gavin Panella
Add instructions for disconnection tests to README.
147
332 by Jamu Kakar
- The README file now includes information about Storm's license,
148
Setting up database users and access security
149
---------------------------------------------
150
151
PostgreSQL needs to be setup to allow TCP/IP connections from
152
localhost.  Edit /etc/postgresql/8.3/main/pg_hba.conf and make sure
153
the following line is present:
154
155
 host all all 127.0.0.1/32 trust
156
157
This will probably (with PostgresSQL 8.4) entail changing 'md5' to
431.2.11 by Free Ekanayaka
Commit non-TPC stores first
158
'trust'.
159
160
In order to run the two-phase commit tests, you will also need to
161
change the max_prepared_transactions value in postgres.conf to
162
something like
163
164
  max_prepared_transactions = 200
165
166
Now save and close, then restart the server:
332 by Jamu Kakar
- The README file now includes information about Storm's license,
167
168
 $ sudo /etc/init.d/postgresql-8.4 restart
169
170
Next, you probably noticed that, while MySQL asked us about a root
171
user several times, PostgreSQL didn't ask us at all.  Lets create
172
our PostgreSQL user now.  As noted in the Ubuntu PostgreSQL
173
documentation, the easiest thing is to create a user with the same
174
name as your username.  Run the following command to create a user
175
for yourself (if prompted for a password, leave it blank):
176
177
 $ sudo -u postgres createuser --superuser $USER
178
179
Despite having created our root user already, MySQL requires an
180
extra step. First we start mysql as the root user (which, you may
181
recall, has no password) with:
182
183
 $ mysql -u root
184
185
Then we create a new user. Be sure to replace YOUR_USERNAME with
186
your actual user name (leaving the quotes in place).
187
188
mysql> GRANT ALL PRIVILEGES ON *.* TO 'YOUR_USERNAME'@'localhost'
189
IDENTIFIED BY '' WITH GRANT OPTION;
190
191
Creating test databases
192
-----------------------
193
194
The test suite needs some local databases in place to exercise MySQL
195
and PostgreSQL functionality.  While still at the MySQL command
196
prompt run:
197
198
mysql> CREATE DATABASE storm_test CHARACTER SET utf8;
199
200
Use Ctrl+D to exit, then, once back on the standard terminal, run
201
the command for PostgreSQL:
202
203
 $ createdb storm_test
204
205
Running the tests
206
-----------------
207
208
Finally, its time to run the tests!  Go into the base directory of
209
the storm branch you want to test, and run:
210
211
 $ make check
212
213
They'll take a while to run.  All tests should pass: failures mean
214
there's a problem with your environment or a bug in Storm.