Changes between Version 42 and Version 43 of DatabaseBackend
- Timestamp:
- Jan 23, 2015, 7:42:20 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DatabaseBackend
v42 v43 1 = Database Backend =1 = Database Backend 2 2 3 Initially, Trac only supported SQLite for its database backend (see PySqlite). 4 5 Postgresql support has been added as of Trac [milestone:0.9]. 6 7 Mysql support will be added for Trac [milestone:0.10] 8 (see this [http://thread.gmane.org/gmane.comp.version-control.subversion.trac.devel/342/focus=348 status report]). 9 10 More generally, since milestone:0.10, Trac offers an easily extensible layer for 11 Database support (see [source:trunk/trac/db/api.py trac.db.api]). 12 13 The existing backends have been refactored and integrated in this 14 layer. There's currently bundled support for: 15 * '''[http://www.sqlite.org SQLite]''', using '''PySqlite''' 3 Since milestone:0.10, Trac offers an easily extensible layer for Database support, see [source:trunk/trac/db/api.py trac.db.api]. The following backends have been integrated in this layer: 4 * '''[http://www.sqlite.org SQLite]''', using '''PySqlite''', the default database 16 5 * '''[http://www.postgresql.org PostgreSQL]''', using the 17 '''[http://initd.org/pub/software/psycopg/ psycopg2]''' bindings .[[br]]6 '''[http://initd.org/pub/software/psycopg/ psycopg2]''' bindings, support added as of Trac [milestone:0.9].[[br]] 18 7 ''Note that ''psycopg1'' 19 8 is not supported anymore and that [http://pypgsql.sourceforge.net/ pyPgSQL] 20 9 also present issues for some users, see #5096).'' [[br]] 21 10 Finally, see #126 for historical notes. 22 * [http://www.mysql.org MySQL], using MySqlDb (see #986 for historical notes)11 * '''[http://www.mysql.org MySQL]''', using MySqlDb, support added for Trac [milestone:0.10]; see [http://thread.gmane.org/gmane.comp.version-control.subversion.trac.devel/342/focus=348 status report] and #986 for historical notes. 23 12 24 There's some work in progress for the following:25 * Ingres (see #6235)26 * Oracle (see #1874)27 * Microsoft SQL Server (see #329)13 There's work in progress for the following databases: 14 * [http://www.actian.com/products/operational-databases/ingres/ Ingres], see #6235. 15 * [http://www.oracle.com/index.html Oracle], see #1874. 16 * [http://www.microsoft.com/en-us/server-cloud/products/sql-server/ Microsoft SQL Server], see #329. 28 17 29 == Backend Specific Installation Instructions ==18 == Backend Specific Installation Instructions 30 19 31 === SQLite ===20 === SQLite 32 21 33 Should be installed out-of-the-box, provided you have installed the PySqlite bindings.22 Installed out-of-the-box, provided you have installed the PySqlite bindings. 34 23 35 Known issues: see [query:keywords=~sqlite&status=!closed pysqlite-related tickets] 24 Known issues: see [query:keywords=~sqlite&status=!closed pysqlite-related tickets]. 36 25 26 === Postgresql 37 27 38 === Postgresql === 39 40 * Have a working copy of Postgresql 41 * Get the proper database driver for Python (see above) 42 * Create a database for your Trac environment 28 Prerequisites: 29 * Have a working copy of Postgresql. 30 * Get the proper database driver for Python, see above. 31 * Create a database for your Trac environment. 43 32 {{{ 44 33 % createdb dbname 45 34 }}} 46 * Run trac-admin to create a new Trac environment. 35 * Run trac-admin to create a new Trac environment. When prompted for a Database connection string, use: 47 36 {{{ 48 37 postgres://user:pass@localhost:5432/dbname?schema=schemaname 49 38 }}} 50 39 51 Notice that the port number might be different in your Postgresql installation, e .g. 5433 (see postgresql.conf).40 Notice that the port number might be different in your Postgresql installation, eg 5433, see postgresql.conf. 52 41 53 42 Alternatively on UNIX, if the database is a local one, you can use UNIX sockets instead of TCP/IP: … … 55 44 postgres://user:pass@/dbname?host=/path/to/unix/socket/dir&schema=schemaname 56 45 }}} 57 If you 're using user trac without a password to connect through unixsockets to database trac and have only one project (hence no need for different schemas), your connections string would be ''postgres://trac:@/trac''46 If you are using user Trac without a password to connect through UNIX sockets to database trac and have only one project (hence no need for different schemas), your connections string would be ''postgres://trac:@/trac'' 58 47 59 48 * Note: '?host=...' is optional. Check your postgresql.conf' unix_socket_directory option if you have connection problems. … … 61 50 See #4546 for more details. 62 51 63 64 65 52 See also #2441, which discusses the process of migration from SQLite to Postgresql. 66 53 67 54 For a postgresql recipe tested on CentOS4 (Red Hat -EL4) see [wiki:PostgresqlRecipe]. 68 55 69 Note: Since Trac [milestone:0.10 0.10] the psycopg1 postgresql driver is no longer supported due to lack of unicode support.56 Note: Since Trac [milestone:0.10 0.10] the psycopg1 postgresql driver is no longer supported due to lack of Unicode support. 70 57 71 58 Known issues: see [query:keywords=~postgres&status=!closed postgres-related tickets] 72 59 60 === MySQL 73 61 74 === MySQL === 62 MySQL is supported by Trac since [milestone:0.10], but there are some caveats, documented in more details in the MySqlDb page. 75 63 76 It is somewhat supported by Trac since [milestone:0.10], but there are some limitations, 77 documented in more details in the MySqlDb page. Use this only if you don't have other choice, and be warned that there can be many issues, in particular related to the unicode support and the repository cache support. Some users are nevertheless using MySQL successfully, so it ''can'' work for you, provided you carefully read and follow the instructions given in the MySqlDb page. 78 79 * Run trac-admin to create a new Trac environment. When prompted for a database connection string, use: 64 * Run trac-admin to create a new Trac environment. When prompted for a database connection string, use: 80 65 {{{ 81 66 mysql://dbuser:dbpass@host:port/dbname … … 95 80 * `unix_socket`: Use a Unix socket at the given path to connect 96 81 97 Known issues: see [query:keywords=~mysql&status=!closed mysql-related tickets] 82 Known issues: see [query:keywords=~mysql&status=!closed mysql-related tickets]. 98 83 99 Users have reported success in [wiki:SqLiteToMySql Conversion from SQLite].84 Users have reported success in [wiki:SqLiteToMySql converting their database from SQLite to MySQL]. 100 85 101 == Alternative Ideas for Database Independence ==86 == Alternative Ideas for Database Independence 102 87 103 === Object-Relational Mapper ===88 === Object-Relational Mapper 104 89 105 90 An ORM could be used to provide a unified object interface to different RDBMS: 106 * some people have been talking about using [http://sqlobject.org SQLObject] 107 to accomplish this goal of database independence. 108 * [http://modeling.sourceforge.net/ Modeling] 109 Another, more advanced (and more complex) OR-Mapper. 110 * [http://www.sqlalchemy.org/ SQLAlchemy] seems to be also quite advanced 91 * some people have been talking about using [http://sqlobject.org SQLObject] to accomplish this goal of database independence. 92 * [http://modeling.sourceforge.net/ Modeling], which is another, more advanced OR-Mapper. 93 * [http://www.sqlalchemy.org/ SQLAlchemy] is also quite advanced. 111 94 112 95 Comparisons between both and more info on Python ORMs: … … 114 97 * http://google.com/search?q=SQLObject+modeling 115 98 116 === Store Tickets and Wiki pages directly in the Subversion repository ===99 === Store Tickets and Wiki pages directly in the Subversion repository 117 100 118 A compelling idea with many advantages. A page advocating this plan is TighterSubversionIntegration. There has also been a discussion on the Trac mailing list . All arguments from this discussionare summarized on the page [wiki:WhySQLite WhySQLite].101 A compelling idea with many advantages. A page advocating this plan is TighterSubversionIntegration. There has also been a discussion on the Trac mailing list, of which the arguments are summarized on the page [wiki:WhySQLite WhySQLite]. 119 102 120 === Other Alternatives ===103 === Other Alternatives 121 104 122 105 * http://wiki.w4py.org/databaseintegration.html