Python MySQLdb.version_info() Examples

The following are 2 code examples for showing how to use MySQLdb.version_info(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module MySQLdb , or try the search function .

Example 1
Project: gprime   Author: GenealogyCollective   File: mysql.py    License: GNU General Public License v2.0 5 votes vote down vote up
def get_summary(cls):
        """
        Return a diction of information about this database
        backend.
        """
        summary = {
            "DB-API version": "2.0",
            "Database SQL type": cls.__name__,
            "Database SQL module": "MySQLdb",
            "Database SQL module version": ".".join([str(v) for v in MySQLdb.version_info]),
            "Database SQL module location": MySQLdb.__file__,
        }
        return summary 
Example 2
Project: djongo   Author: nesdis   File: test_schema.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def test_quote_value(self):
        import MySQLdb
        editor = connection.schema_editor()
        tested_values = [
            ('string', "'string'"),
            (42, '42'),
            (1.754, '1.754e0' if MySQLdb.version_info >= (1, 3, 14) else '1.754'),
            (False, b'0' if MySQLdb.version_info >= (1, 4, 0) else '0'),
        ]
        for value, expected in tested_values:
            with self.subTest(value=value):
                self.assertEqual(editor.quote_value(value), expected)