Parameters:
     - db_name
     - tbl_name
     - new_parts
     - environment_context
180728
def alter_partitions_with_environment_context(self, db_name, tbl_name, new_parts, environment_context):
    
    self.send_alter_partitions_with_environment_context(db_name, tbl_name, new_parts, environment_context)
    self.recv_alter_partitions_with_environment_context()
591029
def add_to_environment(self, environment):
        """"""
        self._env = environment._env
        self._userdata = ffi.new_handle(self)

        ENVIRONMENT_DATA[self._env].routers[self.name] = self

        lib.EnvAddRouterWithContext(
            self._env, self._name.encode(), self._priority,
            lib.query_function,
            lib.print_function,
            lib.getc_function,
            lib.ungetc_function,
            lib.exit_function,
            self._userdata)
296856
def drop_table_with_environment_context(self, dbname, name, deleteData, environment_context):
    
    self.send_drop_table_with_environment_context(dbname, name, deleteData, environment_context)
    self.recv_drop_table_with_environment_context()
510403
def init_db(sqlalchemy_url):
    
    engine = create_engine(sqlalchemy_url)
    start = time.time()
    metadata.create_all(engine)
    return time.time() - start
65573
def rdb_repository(_context, name=None, make_default=False,
                   aggregate_class=None, repository_class=None,
                   db_string=None, metadata_factory=None):
    
    cnf = {}
    if not db_string is None:
        cnf['db_string'] = db_string
    if not metadata_factory is None:
        cnf['metadata_factory'] = metadata_factory
    _repository(_context, name, make_default,
                aggregate_class, repository_class,
                REPOSITORY_TYPES.RDB, 'add_rdb_repository', cnf)
1114047
function getEnvironmentDatabase(req, res, next){
  log.logger.debug('process getEnvironmentDatabase request', req.originalUrl );

  _getEnvironmentDatabase({
    domain: req.params.domain,
    environment: req.params.environment
  }, function(err, envDb){
    if(err){
      log.logger.error('Failed to get mbaas instance', err);
      return next(common.buildErrorObject({
        err: err,
        msg: 'Failed to get mbaas instance',
        httpCode: 500
      }));
    }

    if(!envDb){
      log.logger.error("No Environment Database Found", err);
      return next(common.buildErrorObject({
        err: new Error("No Environment Database Found"),
        httpCode: 400
      }));
    }

    req.mongoUrl = common.formatDbUri(envDb.dbConf);

    log.logger.debug("Found Environment Database", req.mongoUrl);

    return next();
  });
}
365926
def rename_partition(self, db_name, tbl_name, part_vals, new_part):
    
    self.send_rename_partition(db_name, tbl_name, part_vals, new_part)
    self.recv_rename_partition()
776364
def _db_upgrade(self, db_name):
        
        current_db_version = self._get_db_version()
        self._execute(db_schema.functions)
        for i in range(current_db_version, nipap.__db_version__):
            self._logger.info("Upgrading DB schema:", i, "to", i+1)
            upgrade_sql = db_schema.upgrade[i-1] # 0 count on array
            self._execute(upgrade_sql % (db_name))
        self._execute(db_schema.triggers)
397792
def connect_db(database_name=":memory:"):
    
    db = repo.Repo.connect_db(database_name)
    base.Repo.db = db
    query.Repo.db = db
714386
def upgrade(cfg):
    """"""
    db_node = cfg["db"]
    old_db_elems = ["host", "name", "port", "pass", "user", "dialect"]
    has_old_db_elems = [x in db_node for x in old_db_elems]

    if any(has_old_db_elems):
        print("Old database configuration found. "
              "Converting to new connect_string. "
              "This will *not* be stored in the configuration automatically.")
        cfg["db"]["connect_string"] = \
            "{dialect}://{user}:{password}@{host}:{port}/{name}".format(
                dialect=cfg["db"]["dialect"]["value"],
                user=cfg["db"]["user"]["value"],
                password=cfg["db"]["pass"]["value"],
                host=cfg["db"]["host"]["value"],
                port=cfg["db"]["port"]["value"],
                name=cfg["db"]["name"]["value"])
1105083
def get_partitions(self, db_name, tbl_name, max_parts):
    
    self.send_get_partitions(db_name, tbl_name, max_parts)
    return self.recv_get_partitions()
1353810
def drop_partition_with_environment_context(self, db_name, tbl_name, part_vals, deleteData, environment_context):
    
    self.send_drop_partition_with_environment_context(db_name, tbl_name, part_vals, deleteData, environment_context)
    return self.recv_drop_partition_with_environment_context()
216083
def init_db(uri, base, **kwargs):
    
    engine = create_engine(uri, **kwargs)
    base.metadata.create_all(engine)
    return engine
1176937
def add(context, filenames):
    
    logging.info(_('Current Mode: Add Linux data'))
    context.obj['database'].add_data(filenames)
    sys.exit(0)
829002
def alter_table_with_environment_context(self, dbname, tbl_name, new_tbl, environment_context):
    
    self.send_alter_table_with_environment_context(dbname, tbl_name, new_tbl, environment_context)
    self.recv_alter_table_with_environment_context()
918707
def database_create(self, database, **params):
        
        binds = {}
        dbname = database
        for key, engine in self.keys_engines():
            if hasattr(database, '__call__'):
                dbname = database(engine)
            assert dbname, "Cannot create a database, no db name given"
            key = key if key else 'default'
            binds[key] = self._database_create(engine, dbname)
        return self.copy(binds)
28702
def _create_execution_context(self):
        
        if hasattr(self, '_database_link'):
            # client side partitioning query
            return base_execution_context._MultiCollectionQueryExecutionContext(self._client, self._options, self._database_link, self._query, self._partition_key)
        else:
            # 
            return execution_dispatcher._ProxyQueryExecutionContext(self._client, self._collection_link, self._query, self._options, self._fetch_function)