Return the SQLAlchemy database dialect class corresponding
        to this URL's driver name.
164431
def get_dialect(self):
        

        if "+" not in self.drivername:
            name = self.drivername
        else:
            name = self.drivername.replace("+", ".")
        cls = registry.load(name)
        # check for legacy dialects that
        # would return a module with 'dialect' as the
        # actual class
        if (
            hasattr(cls, "dialect")
            and isinstance(cls.dialect, type)
            and issubclass(cls.dialect, Dialect)
        ):
            return cls.dialect
        else:
            return cls
8054
def load_dialect_impl(self, dialect):  # type: (DefaultDialect) -> TypeEngine
        """"""
        if self.__use_json(dialect):
            return dialect.type_descriptor(self.__json_type)
        return dialect.type_descriptor(sqlalchemy.UnicodeText)
431137
def dialect(self):
        
        if self._dialect is None:
            self._dialect = model.DIALECT_DEFAULT
            if self.header:
                source = self.header.sub_tag("SOUR")
                if source:
                    if source.value == "MYHERITAGE":
                        self._dialect = model.DIALECT_MYHERITAGE
                    elif source.value == "ALTREE":
                        self._dialect = model.DIALECT_ALTREE
                    elif source.value == "ANCESTRIS":
                        self._dialect = model.DIALECT_ANCESTRIS
        return self._dialect
590168
def get_current_revision(
        database_url: str,
        version_table: str = DEFAULT_ALEMBIC_VERSION_TABLE) -> str:
    
    engine = create_engine(database_url)
    conn = engine.connect()
    opts = {'version_table': version_table}
    mig_context = MigrationContext.configure(conn, opts=opts)
    return mig_context.get_current_revision()
357304
def __get_dbms_version(self, make_connection=True):
        
        if not self.connection and make_connection:
            self.connect()
        with self.connection.cursor() as cursor:
            cursor.execute("SELECT SERVERPROPERTY('productversion')")
            return cursor.fetchone()[0]
1116353
def db(cls, dbname=None):
        

        cls._load_entry_points()

        dbname = dbname or config.get('eop', 'dbname', fallback=cls.DEFAULT_DBNAME)

        if dbname not in cls._dbs.keys():
            raise EopError("Unknown database '%s'" % dbname)

        if isclass(cls._dbs[dbname]):
            # Instanciation
            try:
                cls._dbs[dbname] = cls._dbs[dbname]()
            except Exception as e:
                # Keep the exception in cache in order to not retry instanciation
                # every single time EopDb.db() is called, as instanciation
                # of database is generally a time consumming operation.
                # If it failed once, it will most probably fail again
                cls._dbs[dbname] = e

        if isinstance(cls._dbs[dbname], Exception):
            raise EopError("Problem at database instanciation") from cls._dbs[dbname]

        return cls._dbs[dbname]
1037941
def _get_sqla_coltype_class_from_str(coltype: str,
                                     dialect: Dialect) -> Type[TypeEngine]:
    
    # noinspection PyUnresolvedReferences
    ischema_names = dialect.ischema_names
    try:
        return ischema_names[coltype.upper()]
    except KeyError:
        return ischema_names[coltype.lower()]
871209
def get_dialect(self):
        """"""

        parameters = {}

        for parameter in self.csv_params[2:]:
            pname, ptype, plabel, phelp = parameter

            widget = self._widget_from_p(pname, ptype)

            if ptype is types.StringType or ptype is types.UnicodeType:
                parameters[pname] = str(widget.GetValue())
            elif ptype is types.BooleanType:
                parameters[pname] = widget.GetValue()
            elif pname == 'quoting':
                choice = self.choices['quoting'][widget.GetSelection()]
                parameters[pname] = getattr(csv, choice)
            else:
                raise TypeError(_("{type} unknown.").format(type=ptype))

        has_header = parameters.pop("self.has_header")

        try:
            csv.register_dialect('user', **parameters)

        except TypeError, err:
            msg = _("The dialect is invalid. \n "
                    "\nError message:\n{msg}").format(msg=err)
            dlg = wx.MessageDialog(self.parent, msg, style=wx.ID_CANCEL)
            dlg.ShowModal()
            dlg.Destroy()
            raise TypeError(err)

        return csv.get_dialect('user'), has_header
1124041
def db_getString(self, db_name, key):
        
        warnings.warn('deprecated', DeprecationWarning)
        return (yield from self.rpc_call('db_getString', [db_name, key]))
78428
public static String driverClass(String url) {
        assert !blank(url);

        if (url.contains(POSTGRESQL_FRAGMENT)) {
            return "org.postgresql.Driver";
        }
        if (url.contains(MYSQL_FRAGMENT)) {
            return "com.mysql.jdbc.Driver";
        }
        if (url.contains(HSQL_FRAGMENT)) {
            return "org.hsqldb.jdbcDriver";
        }
        if (url.contains(H2_FRAGMENT)) {
            return "org.h2.Driver";
        }
        if (url.contains(SQL_SERVER_JTDS_FRAGMENT)) {
            return "net.sourceforge.jtds.jdbc.Driver";
        }
        if (url.contains(SQL_SERVER_MS_2000_FRAGMENT)) {
            return "com.microsoft.jdbc.sqlserver.SQLServerDriver";
        } // 2000
        if (url.contains(SQL_SERVER_MS_2005_FRAGMENT)) {
            return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
        } // 2005
        if (url.contains(DB2_FRAGMENT)) {
            return "com.ibm.db2.jcc.DB2Driver";
        }
        if (url.contains(ORACLE_FRAGMENT)) {
            return "oracle.jdbc.driver.OracleDriver";
        }

        return null;
    }
64245
def _get_db_version(self):
        

        dbname = self._cfg.get('nipapd', 'db_name')
        self._execute("SELECT description FROM pg_shdescription JOIN pg_database ON objoid = pg_database.oid WHERE datname = '%s'" % dbname)
        comment = self._curs_pg.fetchone()
        if comment is None:
            raise NipapDatabaseNoVersionError("Could not find comment of psql database %s" % dbname)

        db_version = None
        m = re.match('NIPAP database - schema version: ([0-9]+)', comment[0])
        if m:
            db_version = int(m.group(1))
        else:
            raise NipapError("Could not match schema version database comment")

        return db_version
1173296
def dbclass(self, value):
        

        if not is_valid_dbclass(value):
            raise AttributeError("'{}' is not a valid database type".format(value))

        self._class = value
        self._connectionXML.set('class', value)
1147220
def get_datatype(cls,
                     db: DATABASE_SUPPORTER_FWD_REF,
                     table: str,
                     column: str) -> str:
        """"""
        raise RuntimeError(_MSG_NO_FLAVOUR)
894437
def get_db_version(session):
    
    value = session.query(ProgramInformation.value).filter(ProgramInformation.name == "db_version").scalar()
    return int(value)
1160347
def pandasSQL_builder(con, schema=None, meta=None,
                      is_cursor=False):
    
    # When support for DBAPI connections is removed,
    # is_cursor should not be necessary.
    con = _engine_builder(con)
    if _is_sqlalchemy_connectable(con):
        return SQLDatabase(con, schema=schema, meta=meta)
    elif isinstance(con, str):
        raise ImportError("Using URI string without sqlalchemy installed.")
    else:
        return SQLiteDatabase(con, is_cursor=is_cursor)
215041
def get_db(cls):
        """"""
        if cls._db:
            return getattr(cls._client, cls._db)
        return cls._client.get_default_database()
813894
def db_type(python_type_representation):
    
    for type_name in _candidate_type_names(python_type_representation):
        db_type_name = _lookup_type_name(type_name)
        if db_type_name:
            return db_type_name
    raise ValueError("Failed to find sqlite3 column type for %s" % (
        python_type_representation))