Map a database name to the Cluster that holds the database.

        Args:
            dbname: A database name.

        Returns:
            A dict containing the information about the Cluster that holds the
            database.
13654
def _match_dbname(self, dbname):
        
        for config in self._clusters:
            if re.match(config['pattern'], dbname):
                return config
        raise Exception('No such database %s.' % dbname)
188169
def get_partition_by_name(self, db_name, tbl_name, part_name):
    
    self.send_get_partition_by_name(db_name, tbl_name, part_name)
    return self.recv_get_partition_by_name()
428169
def get(cls, dbname="perfdump"):
        
        try:
            return cls.connection
        except:
            cls.connect(dbname)
            return cls.connection
1174315
public OvhDatabase serviceName_database_databaseName_GET(String serviceName, String databaseName) throws IOException {
		String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}";
		StringBuilder sb = path(qPath, serviceName, databaseName);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhDatabase.class);
	}
655399
def _get_column_by_db_name(cls, name):
        
        return cls._columns.get(cls._db_map.get(name, name))
181732
String getDatabaseName(String dbName) {
        if (mFileNameMap == null) {
            return null;
        }
        String name = mFileNameMap.get(dbName);
        if (name == null && dbName != null) {
            name = mFileNameMap.get(null);
        }
        if (name == null) {
            return null;
        }
        if (mDatabaseHook != null) {
            try {
                dbName = mDatabaseHook.databaseName(dbName);
            } catch (IncompatibleClassChangeError e) {
                // Method not implemented.
            }
        }
        return dbName;
    }
1040773
def db_list(user=None, password=None, host=None, port=None, authdb=None):
    '''
    
    '''
    conn = _connect(user, password, host, port, authdb=authdb)
    if not conn:
        return 'Failed to connect to mongo database'

    try:
        log.info('Listing databases')
        return conn.database_names()
    except pymongo.errors.PyMongoError as err:
        log.error(err)
        return six.text_type(err)
981479
def db_getHex(self, db_name, key):
        
        warnings.warn('deprecated', DeprecationWarning)
        return (yield from self.rpc_call('db_getHex', [db_name, key]))
801607
public String getDatabase() {

        if (m_databaseKey == null) {
            m_databaseKey = getExtProperty("db.name");
        }
        if (CmsStringUtil.isEmpty(m_databaseKey)) {
            m_databaseKey = getSortedDatabases().get(0);
        }
        return m_databaseKey;
    }
682257
def db_exists(name, user=None, password=None, host=None, port=None, authdb=None):
    '''
    
    '''
    dbs = db_list(user, password, host, port, authdb=authdb)

    if isinstance(dbs, six.string_types):
        return False

    return name in dbs
15471
@Override
    public Map<String, Optional<Partition>> getPartitionsByNames(String databaseName, String tableName, List<String> partitionNames)
    {
        requireNonNull(partitionNames, "partitionNames is null");
        if (partitionNames.isEmpty()) {
            return ImmutableMap.of();
        }

        List<Partition> partitions = batchGetPartition(databaseName, tableName, partitionNames);

        Map<String, List<String>> partitionNameToPartitionValuesMap = partitionNames.stream()
                .collect(toMap(identity(), HiveUtil::toPartitionValues));
        Map<List<String>, Partition> partitionValuesToPartitionMap = partitions.stream()
                .collect(toMap(Partition::getValues, identity()));

        ImmutableMap.Builder<String, Optional<Partition>> resultBuilder = ImmutableMap.builder();
        for (Entry<String, List<String>> entry : partitionNameToPartitionValuesMap.entrySet()) {
            Partition partition = partitionValuesToPartitionMap.get(entry.getValue());
            resultBuilder.put(entry.getKey(), Optional.ofNullable(partition));
        }
        return resultBuilder.build();
    }
151294
def ReadDatabase(self, database_link, options=None):
        
        if options is None:
            options = {}

        path = base.GetPathFromLink(database_link)
        database_id = base.GetResourceIdOrFullNameFromLink(database_link)
        return self.Read(path, 'dbs', database_id, None, options)
550394
def db(self):
        
        if self.database is NotImplemented:
            self.database = Session

        return self.database
495931
def list_database_names(self, session=None):
        
        return [doc["name"]
                for doc in self.list_databases(session, nameOnly=True)]
107492
def get_node_by_name(self, nodename):
        
        for kind, nodes in self.nodes.items():
            for node in nodes:
                if node.name == nodename:
                    return node
        else:
            raise NodeNotFound(
                "Node `{0}` not found in cluster `{1}`"
                .format(nodename, self.name))
134180
def database_exist(self):
        
        binds = {}
        for key, engine in self.keys_engines():
            key = key if key else 'default'
            binds[key] = self._database_exist(engine)
        return binds
890437
def _get_database(self, options):
        """"""
        database_name = options.get('database')
        if not database_name:
            if len(settings.DATABASES) > 1:
                errmsg = "Because this project contains more than one database, you"\
                    " must specify the --database option."
                raise CommandError(errmsg)
            database_name = list(settings.DATABASES.keys())[0]
        if database_name not in settings.DATABASES:
            raise CommandError("Database %s does not exist." % database_name)
        return database_name, settings.DATABASES[database_name]