[SQL-CVS] SQLObject/docs SQLObject.txt,1.15,1.16
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <ian...@us...> - 2003-11-01 20:24:28
|
Update of /cvsroot/sqlobject/SQLObject/docs In directory sc8-pr-cvs1:/tmp/cvs-serv18590 Modified Files: SQLObject.txt Log Message: Updated for 0.5 Index: SQLObject.txt =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/docs/SQLObject.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** SQLObject.txt 10 Jul 2003 19:28:50 -0000 1.15 --- SQLObject.txt 1 Nov 2003 20:24:24 -0000 1.16 *************** *** 43,49 **** ============ ! Currently SQLObject supports MySQL, PostgreSQL (via ``psycopg``), ! SQLite, and a DBM-based store. The DBM backend is the youngest, ! and somewhat experimental. Python 2.2 or higher is required. SQLObject makes extensive use of --- 43,53 ---- ============ ! Currently SQLObject supports MySQL_, PostgreSQL_ (via ``psycopg``), ! SQLite_, Firebird_, and a DBM-based store. The DBM backend is ! experimental. ! ! .. _PostgreSQL: http://postgresql.org ! .. _SQLite: http://sqlite.org ! .. _Firebird: http://firebird.sourceforge.net Python 2.2 or higher is required. SQLObject makes extensive use of *************** *** 113,127 **** Here are some things I plan: ! * More databases supported. SQL databases (like Oracle or Firebird) ! should be easy, non-SQL databases like Metakit should be possible. * Better transaction support -- right now you can use transactions for the database, but the object isn't transaction-aware, so non-database persistence won't be able to be rolled back. ! Locking and other techniques to handle concurrency will also be ! implemented (probably in 0.5). * Profile of SQLObject performance, so that I can identify bottlenecks. ! * Makes hooks with a validation and form generation package, so ! SQLObject classes (read: schemas) can be published for editing ! more directly and easily. * Automatic joins in select queries. * More kinds of joins, and more powerful join results (closer to how --- 117,130 ---- Here are some things I plan: ! * More databases supported. There has been interest and some work in ! the progress for Oracle, Sybase, and MS-SQL support. * Better transaction support -- right now you can use transactions for the database, but the object isn't transaction-aware, so non-database persistence won't be able to be rolled back. ! * Optimistic locking and other techniques to handle concurrency. * Profile of SQLObject performance, so that I can identify bottlenecks. ! * Increase hooks with FormEncode (unreleased) validation and form ! generation package, so SQLObject classes (read: schemas) can be ! published for editing more directly and easily. * Automatic joins in select queries. * More kinds of joins, and more powerful join results (closer to how *************** *** 138,142 **** To begin with, let's make a database connection. Choose from one of `MySQLConnection`, `PostgresConnection`, `SQLiteConnection`, and ! `DBMConnection`, depending on what database you use. .. raw:: html --- 141,145 ---- To begin with, let's make a database connection. Choose from one of `MySQLConnection`, `PostgresConnection`, `SQLiteConnection`, and ! `FirebirdConnection`, depending on what database you use. .. raw:: html *************** *** 144,150 **** The rest of this will be written more-or-less in a database-agnostic ! manner, using the connection you define. (Use `DBMConnection` if you ! don't have another database installed or ready -- it only uses ! standard Python modules, and writes to a directory) We'll develop a simple addressbook-like database. We could create the --- 147,155 ---- The rest of this will be written more-or-less in a database-agnostic ! manner, using the connection you define. Use `SQLite` if you don't ! have another database installed or ready -- it requires PySQLite_, but ! doesn't require a client/server setup. ! ! .. _PySQLite: http://pysqlite.sourceforge.net/ We'll develop a simple addressbook-like database. We could create the *************** *** 166,174 **** :file: ../examples/snippets/simpleaddress-schema-person1.html ! This is for MySQL. The schema for Postgres or SQLite looks a little different (especially the ``id`` column). You'll notice the names were changed from mixedCase to underscore_separated -- this is done by ! the `style object`_. There are a variety of ways to handle ! other names that are not as SQLObject expects (see `Irregular Naming`_). .. _`style object`: `Changing the Naming Style`_ --- 171,179 ---- :file: ../examples/snippets/simpleaddress-schema-person1.html ! This is for MySQL. The schema for other databases looks slightly different (especially the ``id`` column). You'll notice the names were changed from mixedCase to underscore_separated -- this is done by ! the `style object`_. There are a variety of ways to handle that names ! that don't fit conventions (see `Irregular Naming`_). .. _`style object`: `Changing the Naming Style`_ *************** *** 193,199 **** as ``INT PRIMARY KEY AUTO_INCREMENT``, in Postgres ``SERIAL PRIMARY KEY``, and in SQLite as ``INTEGER PRIMARY KEY``. You can `override the ! name`__, but some integer primary key must exist. __ idName_ Using the Class --- 198,206 ---- as ``INT PRIMARY KEY AUTO_INCREMENT``, in Postgres ``SERIAL PRIMARY KEY``, and in SQLite as ``INTEGER PRIMARY KEY``. You can `override the ! name`__, but some integer primary key must exist (though `you can use ! non-integer keys`_ with some extra effort). __ idName_ + .. _`you can use non-integer keys`: `Non-Integer Keys`_ Using the Class *************** *** 350,354 **** :file: ../examples/snippets/person-select3.html ! You may wish to use `SQLBuilder.sqlRepr` to quote any values you use if you use this technique (quoting is automatic if you use ``q``). Tables given in `clauseTables` will be added to the ``FROM`` portion --- 357,361 ---- :file: ../examples/snippets/person-select3.html ! You may wish to use `MyClass.sqlrepr` to quote any values you use if you use this technique (quoting is automatic if you use ``q``). Tables given in `clauseTables` will be added to the ``FROM`` portion *************** *** 533,536 **** --- 540,567 ---- different types of columns, when SQLObject creates your tables. + `BoolCol`: + Will create a ``BOOLEAN`` column in Postgres, or ``INT`` in other + databses. It will also convert values to ``"t"/"f"`` or ``0/1`` + according to the database backend. + `CurrencyCol`: + Equivalent to ``DecimalCol(size=10, precision=2)``. + `DateTimeCol`: + A date and time (usually returned as an mxDateTime object). + `DecimalCol`: + Base-10, precise number. Uses the keyword arguments `size` for + number of digits stored, and `precision` for the number of digits + after the decimal point. + `EnumCol`: + One of several string values -- give the possible strings as a + list, with the `enumValues` keyword argument. MySQL has a native + ``ENUM`` type, but will work with other databases too (storage + just won't be as efficient). + `FloatCol`: + Floats. + `ForeignKey`: + A key to another table/class. Use like ``user = + ForeignKey('User')``. + `IntCol`: + Integers. `StringCol`: A string (character) column. Extra keywords: *************** *** 543,566 **** ``CHAR`` and ``VARCHAR``, default True, i.e., use ``VARCHAR``. - `IntCol`: - Integers, real simple. - `FloatCol`: - Floats. - `ForeignKey`: - A key to another table/class. Use like ``user = - ForeignKey('User')``. - `EnumCol`: - One of several string values -- give the possible strings as a - list, with the `enumValues` keyword argument. MySQL has a native - ``ENUM`` type, but will work with other databases too (storage - just won't be as efficient). - `DateTimeCol`: - A date and time (usually returned as an mxDateTime object). - `DecimalCol`: - Base-10, precise number. Uses the keyword arguments `size` for - number of digits stored, and `precision` for the number of digits - after the decimal point. - `CurrencyCol`: - Equivalent to ``DecimalCol(size=10, precision=2)``. SQLObject Class: Specifying Your Class --- 574,577 ---- *************** *** 784,788 **** columns will be added. ! *This is only supported in MySQL and Postgres* Runtime Column Changes --- 795,799 ---- columns will be added. ! *This is not supported in SQLite* Runtime Column Changes *************** *** 901,904 **** --- 912,924 ---- column name. + Non-Integer Keys + ---------------- + + While not strictly a legacy database issue, this fits into the + category of "irregularities". If you use non-integer keys, all + primary key management is up to you. You must create the table + yourself, and when you create instances you must pass a ``id`` keyword + argument into ``new`` (like ``Person.new(id='555-55-5555', ...)``). + DBConnection: Database Connections ================================== *************** *** 920,924 **** MySQLConnection supports all the features, though MySQL does not support transactions_ (except using a special proprietary backend that ! no one I've seen uses). Postgres --- 940,944 ---- MySQLConnection supports all the features, though MySQL does not support transactions_ (except using a special proprietary backend that ! I haven't used). Postgres *************** *** 948,951 **** --- 968,983 ---- SQLite may have concurrency issues, depending on your usage in a multi-threaded environment. + + Firebird + -------- + + `FirebirdConnection` takes the arguments `host`, `db`, `user` (default + ``"sysdba"``), `passwd` (default ``"masterkey"``). + + Firebird supports all the features. Support is still young, so there + may be some issues, especially with concurrent access, and especially + using lazy selects. Try ``list(MyClass.select())`` to avoid + concurrent cursors if you have problems (using ``list()`` will + pre-fetch all the results of a select). DBMConnection |