Plone and MariaDB
So as well as MySQL, Zope/Plone lets you integrate and manage data in MariaDB in many different ways.
Prerequisite
MySQL python module (MySQLdb) is a Python database API for MySQL (and also MariaDB). It is needed in first place when you want to make Zope/Plone to work with MariaDB.
In order to make MySQL-python works smoothly with MariaDB, you have to make sure the socket file of MariaDB locates in the same path as MySQL i.e. you should set socket option in my.cnf configuration file to:
[mysqld]
socket = /var/run/mysqld/mysqld.sock
Using ZMySQLDA and Z SQL method
The ZMySQLDA is used to connect Zope to the actual MariaDB/MySQL database. If you have installed the ZMySQLDA package successfully, you will see “Z MYSQL Database Connection” in the drop down menu located at the top right corner of the ZMI. You can easily create a connection to your MariaDB by add a new Z MySQL Database Connection object and configure it.
After created a connection, you can perform many actions such as select, insert, delete etc. to your MariaDB database using Z SQL Method objects.
Z SQL Method and Z MySQL Database Connection objects could be used in many Zope/Plone components e.g. ZPT, Python Script, Archetypes and PloneFormGen.
Using SQLAlchemy
SQLAlchemy is a comprehensive set of tools for working with databases and Python. With SQLAlchemy, you have the power to control almost everything in your MariaDB bases on the Object Relational Mapper.
In Zope/Plone, you should use one of the helper additional packages bellow when working with SQLAlchemy that support Zope transaction integration:
- zope.sqlalchemy
- z3c.sqlalchemy
- collective.lead
Remember to keep mysql as the driver name in your DSN, do not change it to mariadb. The DSN should be something like 'mysql://user:password@host/dbname'.
Using RelStorage
RelStorage is a storage implementation for ZODB that stores pickles in a relational database. RelStorage enables you to replace the built-in FileStorage of ZODB with a RDBMS e.g. MySQL, Oracle, PostgreSQL and MariaDB.
RelStorage requires InnoDB to be enabled when working with MariaDB. MariaDB from 5.1 included two plugins InnoDB and XtraDB by default. You only need to check whether one of these plugins be installed (XtraDB also supports InnoDB storage engine). If not, you should install it by using the INSTALL PLUGIN command e.g.
INSTALL PLUGIN innodb SONAME 'ha_innodb_plugin.so';
References
MariaDB versus MySQL
http://kb.askmonty.org/v/mariadb-versus-mysql-compatibility
MySQL Python
http://mysql-python.sourceforge.net/
Plone and MySQL
http://plone.org/documentation/kb/plone-and-mysql
ZMySQLDA
http://www.zope.org/Members/adustman/Products/ZMySQLDA
ZSQL Methods User Guide:
http://www.zope.org/Documentation/Guides/ZSQL/2.1.1%20pdf/ZSQL.pdf
zope.sqlalchemy
http://pypi.python.org/pypi/zope.sqlalchemy
z3c.sqlalchemy
http://pypi.python.org/pypi/z3c.sqlalchemy
collective.lead
http://pypi.python.org/pypi/collective.lead/
RelStorage
http://pypi.python.org/pypi/RelStorage

Author: