~ubuntu-branches/debian/jessie/sqlalchemy/jessie

« back to all changes in this revision

Viewing changes to lib/sqlalchemy/dialects/__init__.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski, Jakub Wilk, Piotr Ożarowski
  • Date: 2013-07-06 20:53:52 UTC
  • mfrom: (1.4.23) (16.1.17 experimental)
  • Revision ID: package-import@ubuntu.com-20130706205352-ryppl1eto3illd79
Tags: 0.8.2-1
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Piotr Ożarowski ]
* New upstream release
* Upload to unstable
* Build depend on python3-all instead of -dev, extensions are not built for
  Python 3.X 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# dialects/__init__.py
2
 
# Copyright (C) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>
 
2
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
3
3
#
4
4
# This module is part of SQLAlchemy and is released under
5
5
# the MIT License: http://www.opensource.org/licenses/mit-license.php
6
6
 
7
7
__all__ = (
8
 
#    'access',
9
8
    'drizzle',
10
9
    'firebird',
11
10
#    'informix',
12
 
#    'maxdb',
13
11
    'mssql',
14
12
    'mysql',
15
13
    'oracle',
17
15
    'sqlite',
18
16
    'sybase',
19
17
    )
 
18
 
 
19
from .. import util
 
20
 
 
21
def _auto_fn(name):
 
22
    """default dialect importer.
 
23
 
 
24
    plugs into the :class:`.PluginLoader`
 
25
    as a first-hit system.
 
26
 
 
27
    """
 
28
    if "." in name:
 
29
        dialect, driver = name.split(".")
 
30
    else:
 
31
        dialect = name
 
32
        driver = "base"
 
33
    try:
 
34
        module = __import__('sqlalchemy.dialects.%s' % (dialect, )).dialects
 
35
    except ImportError:
 
36
        return None
 
37
 
 
38
    module = getattr(module, dialect)
 
39
    if hasattr(module, driver):
 
40
        module = getattr(module, driver)
 
41
        return lambda: module.dialect
 
42
    else:
 
43
        return None
 
44
 
 
45
registry = util.PluginLoader("sqlalchemy.dialects", auto_fn=_auto_fn)