Helper function to execute the database creation.
332325
function createDatabase(database, callback) {

    database.type = databases.alias(database.type);

    //
    // Make sure that the user is passing in a valid database type
    //
    if (databases.available.indexOf(database.type) === -1) {
      jitsu.log.warn('Invalid database type ' + database.type.red);
      database.type = null;
      return promptForDatabase(callback);
    }

    jitsu.databases.create(database.type, database.name, function (err, a, res) {
      if (err || res.statusCode >= 400) {
        //
        // TODO: Refactor this error handling
        //
        if (err && (err.statusCode === 409 || err.statusCode === 404)) {
          jitsu.log.error('Database with name ' + database.name.magenta + ' already exists');
          jitsu.log.info('Try again with a new database name');
          database.name = null;
          return promptForDatabase(callback);
        }
        else {
          jitsu.log.error('Database could not be created');
          jitsu.log.error(err || ('Unknown error code: ' + res.statusCode));
          jitsu.log.error('Try again and if it still fails, please contact nodejitsu');
          return callback(err);
        }
      }
      else {
        jitsu.log.info('A new ' + database.type.magenta + ' has been created');
      }

      databases.get(database.name, callback);
    });
  }
161892
def create_db(name, **client_args):
    '''
    
    '''
    if db_exists(name, **client_args):
        log.info('DB \'%s\' already exists', name)
        return False

    client = _client(**client_args)
    client.create_database(name)

    return True
876163
def create():
    """"""
    if not all(map(os.path.isdir, ARGS.directory)):
        exit('Error: One or more of the specified directories does not exist.')
    with sqlite3.connect(ARGS.database) as connection:
        connection.text_factory = str
        cursor = connection.cursor()
        cursor.execute('DROP TABLE IF EXISTS Movies')
        cursor.execute('''CREATE TABLE Movies(name TEXT, path TEXT, size TEXT,
                          files BLOB)''')
        for dir in ARGS.directory:
            cursor.executemany('INSERT INTO Movies VALUES(?, ?, ?, ?)',
                               local_data(dir))
757673
def create_table_sql(cls, db):
        '''
        
        '''
        parts = ['CREATE TABLE IF NOT EXISTS `%s`.`%s` (' % (db.db_name, cls.table_name())]
        cols = []
        for name, field in iteritems(cls.fields()):
            cols.append('    %s %s' % (name, field.get_sql()))
        parts.append(',\n'.join(cols))
        parts.append(')')
        parts.append('ENGINE = ' + cls.engine.create_table_sql(db))
        return '\n'.join(parts)
1060781
async def setup(self):
        """"""
        try:
            engine = await self.db
            created = False
            if not await engine.has_table(self.table_name):
                # create table
                logger.info("Creating SQL table [{}]".format(self.table_name))
                items = self._get_table()
                await engine.execute(CreateTable(items))
                # create indeces
                conn = await engine.connect()
                await conn.execute(
                    "CREATE INDEX `lb_last_updated` ON `{}` (`source_id` DESC,`updated` DESC);".format(self.table_name))
                await conn.execute(
                    "CREATE INDEX `lb_post` ON `{}` (`target_id` DESC,`post_id` DESC);".format(self.table_name))
                await conn.close()
                created = True
            # create control table if not already created.
            if self.control_table_name and not await engine.has_table(self.control_table_name):
                # create table
                logger.info("Creating SQL control table [{}]".format(self.control_table_name))
                items = self._get_control_table()
                await engine.execute(CreateTable(items))
                created = True
            return created
        except Exception as exc:
            logger.error("[DB] Error when setting up SQL table: {}".format(exc))
        return False
964637
def create_db(self, models):
        """"""
        # first create the table definitions
        self.tables = dict(
            [
                (model_name, self.create_model_table(model))
                for model_name, model in iteritems(models)
            ]
        )
        # now create the tables in memory
        logger.debug("Creating %d database table(s)...", len(self.tables))
        try:
            self.Base.metadata.create_all(self.engine)
        except Exception as exc:
            raise StatikError(
                message="Failed to create in-memory data model.",
                orig_exc=exc
            )
        self.load_all_model_data(models)
14602
final public function execute()
    {
        $platform = $this->connection->getDatabasePlatform();
        $queries  = $this->currentSchema->getMigrateToSql($this->schema, $platform);

        foreach ($queries as $query) {
            $this->connection->query($query);
        }
    }
33741
def init(context, reset, force):
    """"""
    existing_tables = context.obj['store'].engine.table_names()
    if force or reset:
        if existing_tables and not force:
            message = f"Delete existing tables? [{', '.join(existing_tables)}]"
            click.confirm(click.style(message, fg='yellow'), abort=True)
        context.obj['store'].drop_all()
    elif existing_tables:
        click.echo(click.style("Database already exists, use '--reset'", fg='red'))
        context.abort()

    context.obj['store'].setup()
    message = f"Success! New tables: {', '.join(context.obj['store'].engine.table_names())}"
    click.echo(click.style(message, fg='green'))
345928
def execute(self):
        
        from ambry.mprlib import execute_sql

        execute_sql(self._bundle.library, self.record_content)
725762
def init():
    """"""
    click.secho('Creating database {0}'.format(_db.engine.url),
                fg='green')
    if not database_exists(str(_db.engine.url)):
        create_database(str(_db.engine.url))
589647
def create(self):
        """"""
        self.db_attrs = self.consul.create_db(
                self.instance_name,
                self.instance_type,
                self.admin_username,
                self.admin_password,
                db_name=self.db_name,
                storage_size_gb=self.storage_size,
                timeout_s=self.launch_timeout_s,
                )
439300
public function create_database($database) {
		$query = 'CREATE DATABASE ' . $this->quote_identifier($database);
		$statement = $this->get_statement($query);

		$statement->execute();
	}
297527
protected function createDatabase()
    {
        /** @var Container $container */
        $container = $this->console->container;

        $dbService = $container->get(DatabaseService::class);
        $config    = $dbService->getDbConfig();

        // Auto create database
        $name = $config['name'];

        $config['name'] = null;

        $db = $dbService->createConnection('_preset', $config->toArray());

        $db->getDatabase($name)->create(true);

        $db->select($name);

        $config['name'] = $name;
    }
146711
def init(**kwargs):
    

    # TODO: Iterate through all engines in name set.
    database = kwargs.pop('database', False)
    if database and not database_exists(engine['default'].url):
        create_database(engine['default'].url, encoding='utf8')
        clear_cache()

    expression = lambda target, table: table.create(target)
    test = lambda target, table: table.exists(target)
    op(expression, test=test, primary='init', secondary='create', **kwargs)
1345413
def db_exec(self, sql: str, *args) -> int:
        """"""
        self.ensure_db_open()
        cursor = self.db.cursor()
        return self.db_exec_with_cursor(cursor, sql, *args)
1327451
def create_db(self, app):
        """"""
        assert 'ZODB_STORAGE' in app.config, \
               'ZODB_STORAGE not configured'
        storage = app.config['ZODB_STORAGE']
        if isinstance(storage, basestring):
            factory, dbargs = zodburi.resolve_uri(storage)
        elif isinstance(storage, tuple):
            factory, dbargs = storage
        else:
            factory, dbargs = storage, {}
        return DB(factory(), **dbargs)
1346154
def init_database(self):
        """"""
        with contextlib.closing(self.database.cursor()) as cursor:
            cursor.execute("""
              CREATE TABLE IF NOT EXISTS users(
                id INTEGER PRIMARY KEY AUTOINCREMENT,
                name VARCHAR(32)
              )
            """)