# -*- coding: utf-8 -*-
from .sqlite import SQLiteAdapter, SpatiaLiteAdapter, JDBCSQLiteAdapter
from .mysql import MySQLAdapter
from .postgres import PostgreSQLAdapter, NewPostgreSQLAdapter, JDBCPostgreSQLAdapter
from .oracle import OracleAdapter
from .mssql import MSSQLAdapter, MSSQL2Adapter, MSSQL3Adapter, MSSQL4Adapter, \
    VerticaAdapter, SybaseAdapter
from .firebird import FireBirdAdapter
from .informix import InformixAdapter, InformixSEAdapter
from .db2 import DB2Adapter
from .teradata import TeradataAdapter
from .ingres import IngresAdapter, IngresUnicodeAdapter
from .sapdb import SAPDBAdapter
from .cubrid import CubridAdapter
from .google import GoogleDatastoreAdapter, GoogleSQLAdapter
from .couchdb import CouchDBAdapter
from .mongo import MongoDBAdapter
from .imap import IMAPAdapter


ADAPTERS = {
    'sqlite': SQLiteAdapter,
    'spatialite': SpatiaLiteAdapter,
    'sqlite:memory': SQLiteAdapter,
    'spatialite:memory': SpatiaLiteAdapter,
    'mysql': MySQLAdapter,
    'postgres': PostgreSQLAdapter,
    'postgres:psycopg2': PostgreSQLAdapter,
    'postgres:pg8000': PostgreSQLAdapter,
    'postgres2:psycopg2': NewPostgreSQLAdapter,
    'postgres2:pg8000': NewPostgreSQLAdapter,
    'oracle': OracleAdapter,
    'mssql': MSSQLAdapter,
    'mssql2': MSSQL2Adapter,
    'mssql3': MSSQL3Adapter,
    'mssql4' : MSSQL4Adapter,
    'vertica': VerticaAdapter,
    'sybase': SybaseAdapter,
    'db2:ibm_db_dbi': DB2Adapter,
    'db2:pyodbc': DB2Adapter,
    'teradata': TeradataAdapter,
    'informix': InformixAdapter,
    'informix-se': InformixSEAdapter,
    'firebird': FireBirdAdapter,
    'firebird_embedded': FireBirdAdapter,
    'ingres': IngresAdapter,
    'ingresu': IngresUnicodeAdapter,
    'sapdb': SAPDBAdapter,
    'cubrid': CubridAdapter,
    'jdbc:sqlite': JDBCSQLiteAdapter,
    'jdbc:sqlite:memory': JDBCSQLiteAdapter,
    'jdbc:postgres': JDBCPostgreSQLAdapter,
    'gae': GoogleDatastoreAdapter, # discouraged, for backward compatibility
    'google:datastore': GoogleDatastoreAdapter,
    'google:datastore+ndb': GoogleDatastoreAdapter,
    'google:sql': GoogleSQLAdapter,
    'couchdb': CouchDBAdapter,
    'mongodb': MongoDBAdapter,
    'imap': IMAPAdapter
}

@@ -641,69 +641,8 @@
 ter%0A
-from .google import GoogleDatastoreAdapter, GoogleSQLAdapter%0A
 from
@@ -1845,13 +1845,120 @@
    '
-gae':
+couchdb': CouchDBAdapter,%0A    'mongodb': MongoDBAdapter,%0A    'imap': IMAPAdapter%0A%7D%0A%0Atry:%0A    from .google import
  Goo
@@ -1977,16 +1977,37 @@
 Adapter,
+ GoogleSQLAdapter%0A   
  # disco
@@ -2041,24 +2041,101 @@
 ibility%0A    
+ADAPTERS%5B'gae'%5D = GoogleDatastoreAdapter%0A    # add gae adapters%0A    ADAPTERS%5B
 'google:data
@@ -2140,17 +2140,19 @@
 tastore'
-:
+%5D =
  GoogleD
@@ -2158,38 +2158,46 @@
 DatastoreAdapter
-,
 %0A    
+ADAPTERS%5B
 'google:datastor
@@ -2202,17 +2202,19 @@
 ore+ndb'
-:
+%5D =
  GoogleD
@@ -2228,22 +2228,30 @@
 eAdapter
-,
 %0A    
+ADAPTERS%5B
 'google:
@@ -2254,17 +2254,19 @@
 gle:sql'
-:
+%5D =
  GoogleS
@@ -2278,94 +2278,72 @@
 pter
-,%0A    'couchdb': CouchDBAdapter,%0A    'mongodb': MongoDBAdapter,%0A    'imap': IMAPAdapter%0A%7D
+%0Aexcept:%0A    # don't bother, we're not on Google AppEngine%0A    pass
 %0A

Fix GAE imports when not available