Method: constructor
 Arguments: database (string) - name of the migration's database
 Starts the @dbr connection, creates it if the file doesn't exist
 Method: create_table
 Arguments: table (string)
 Creates a table in the database
778614
def create_table(table)
      puts "attempting to create table #{table}..."
      begin
        tt = @dbr.prepare("CREATE TABLE #{table}(id INTEGER PRIMARY KEY);")
        ee = tt.execute
        puts "table created correctly.".green
      rescue
        puts "error while creating table #{table}".red
        exit
      end
    end
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)
1053296
def get_or_create(self, db_name):
        
        if not db_name in self:
            res = self.resource.put(db_name)
            if not res[0] == 201:
                raise RuntimeError(
                    'Failed to create database "{}"'.format(db_name)
                )
        return self[db_name]
482934
public void createDatabase(String database, Map<String, String> replacer) {

        m_errorLogging = true;
        executeSql(database, "create_db.sql", replacer, true);
    }
763338
def db_tables(name, **connection_args):
    '''
    
    '''
    if not db_exists(name, **connection_args):
        log.info('Database \'%s\' does not exist', name)
        return False

    dbc = _connect(**connection_args)
    if dbc is None:
        return []
    cur = dbc.cursor()
    s_name = quote_identifier(name)
    # identifiers cannot be used as values
    qry = 'SHOW TABLES IN {0}'.format(s_name)
    try:
        _execute(cur, qry)
    except MySQLdb.OperationalError as exc:
        err = 'MySQL Error {0}: {1}'.format(*exc.args)
        __context__['mysql.error'] = err
        log.error(err)
        return []

    ret = []
    results = cur.fetchall()
    for table in results:
        ret.append(table[0])
    log.debug(ret)
    return ret
1315811
def create_db(app, appbuilder):
    
    from flask_appbuilder.models.sqla import Base

    _appbuilder = import_application(app, appbuilder)
    engine = _appbuilder.get_session.get_bind(mapper=None, clause=None)
    Base.metadata.create_all(engine)
    click.echo(click.style("DB objects created", fg="green"))
1050333
function createTable (db, name) {
  return r.db(db).tableCreate(name).run().then(function () {
    console.log('RETHINKDB: Created Table', name, 'on', db)
  }).catch(function (err) {
    console.log('RETHINKDB: Table', name, 'on', db, 'exists')
  })
}
1049659
private void createTables(Connection conn) throws DatabaseException {
        LOGGER.debug("Creating database structure");

        try (InputStream is = FileUtils.getResourceAsStream(DB_STRUCTURE_RESOURCE)) {
            final String dbStructure = IOUtils.toString(is, StandardCharsets.UTF_8);

            Statement statement = null;
            try {
                statement = conn.createStatement();
                statement.execute(dbStructure);
            } catch (SQLException ex) {
                LOGGER.debug("", ex);
                throw new DatabaseException("Unable to create database statement", ex);
            } finally {
                DBUtils.closeStatement(statement);
            }
        } catch (IOException ex) {
            throw new DatabaseException("Unable to create database schema", ex);
        }
    }
786883
def create_new_database(request):
    """"""
    name = "Create a New MongoDB Database"

    if request.method == 'POST':
        form = CreateDatabaseForm(request.POST)

        if form.is_valid():
            result = form.save()
            if "error" in result:
                messages.error(
                    request, "The database creation operation failed.")
                messages.error(request, result["error"])
            else:
                messages.success(request, "Database created.")
            return HttpResponseRedirect(reverse('djmongo_show_dbs'))
        else:
            # The form is invalid
            messages.error(
                request, _("Please correct the errors in the form."))
            return render(request,
                          'djmongo/console/generic/bootstrapform.html',
                          {'form': form,
                           'name': name})

    else:
        # this is a GET
        context = {'name': name,
                   'form': CreateDatabaseForm(
                       initial={"initial_document": '{ "foo" : "bar" }'
                                })
                   }
        return render(request, 'djmongo/console/generic/bootstrapform.html',
                      context)
424601
def _create_table():
    '''
    
    '''
    # Explicitely check if the table already exists as the library logs a
    # warning on CREATE TABLE
    query = """SELECT COUNT(TABLE_NAME) FROM information_schema.tables
        WHERE table_schema = '{0}' AND table_name = '{1}'""".format(
            _mysql_kwargs['db'],
            _table_name,
        )
    cur, _ = run_query(client, query)
    r = cur.fetchone()
    cur.close()
    if r[0] == 1:
        return

    query = """CREATE TABLE IF NOT EXISTS {0} (
      bank CHAR(255),
      etcd_key CHAR(255),
      data MEDIUMBLOB,
      PRIMARY KEY(bank, etcd_key)
    );""".format(_table_name)
    log.info("mysql_cache: creating table %s", _table_name)
    cur, _ = run_query(client, query)
    cur.close()
1326355
def create(database, tlmdict=None):
    
    if tlmdict is None:
        tlmdict = tlm.getDefaultDict()
    
    dbconn = connect(database)

    for name, defn in tlmdict.items():
        createTable(dbconn, defn)

    return dbconn
970524
public Table build(DB db) {
    if (tableName == null) {
      throw new InvalidOperationException("The table name has not been set.");
    }
    if (tableColumns == null) {
      tableColumns = ALL_COLUMNS;
    }
    return new Table(CallInfo.create(), db, tableName, tableColumns, keyColumns); 
  }
948979
def create_user(self, name, password, database_names, host=None):
        
        if not isinstance(database_names, (list, tuple)):
            database_names = [database_names]
        # The API only accepts names, not DB objects
        database_names = [db if isinstance(db, six.string_types) else db.name
                for db in database_names]
        self._user_manager.create(name=name, password=password,
                database_names=database_names, host=host, return_none=True)
        # Since the API doesn't return the info for creating the user object,
        # we have to do it manually.
        return self._user_manager.find(name=name)
716680
protected function createTableIfDoesNotExist() : void
    {
        /**
         * Note: This is a somewhat hacky way to determine which database driver we're using
         * Ideally, in the future, the query builder will be able to create tables for us
         * Until then, we'll infer the database driver from the query builder type
         */
        switch (get_class($this->queryBuilder)) {
            case MySqlQueryBuilder::class:
                $sql = 'CREATE TABLE IF NOT EXISTS ' .
                    $this->tableName .
                    ' (migration varchar(255), dateran timestamp NOT NULL, PRIMARY KEY (migration));';
                break;
            case PostgreSqlQueryBuilder::class:
                $sql = 'CREATE TABLE IF NOT EXISTS ' .
                    $this->tableName .
                    ' (migration text primary key, dateran timestamp with time zone NOT NULL);';
                break;
            default:
                throw new RuntimeException('Unexpected query builder type ' . get_class($this->queryBuilder));
        }

        $statement = $this->connection->prepare($sql);
        $statement->execute();
    }
836226
def create_table(self, model_class):
        '''
        
        '''
        if model_class.is_system_model():
            raise DatabaseException("You can't create system table")
        if getattr(model_class, 'engine') is None:
            raise DatabaseException("%s class must define an engine" % model_class.__name__)
        self._send(model_class.create_table_sql(self))
289235
def _create_db(self):
        
        log.debug("Creating sqlite database")
        self._conn = sqlite3.connect(self._db_filename)

        # create table structure
        self._conn.cursor().execute("""
        CREATE TABLE IF NOT EXISTS {}
        (
          ts REAL,
          arbitration_id INTEGER,
          extended INTEGER,
          remote INTEGER,
          error INTEGER,
          dlc INTEGER,
          data BLOB
        )
        """.format(self.table_name))
        self._conn.commit()

        self._insert_template = "INSERT INTO {} VALUES (?, ?, ?, ?, ?, ?, ?)".format(self.table_name)
1035753
def create_database(self):
        
        if not self._database_exists():
            con = psycopg2.connect(host=self.host, database="postgres",
                user=self.user, password=self.password, port=self.port)
            con.set_isolation_level(
                psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
            query = "CREATE DATABASE {0};".format(self.dbname)
            c = con.cursor()
            c.execute(query)            
            con.close()


            if self.normalize:
                self.open_database()
                query = "CREATE EXTENSION IF NOT EXISTS \"plperlu\";"
                self.execute_sql(query)
    #            query = """CREATE OR REPLACE FUNCTION normalize(str text)
    #RETURNS text
    #AS $$
    #import unicodedata
    #return ''.join(c for c in unicodedata.normalize('NFKD', str)
    #if unicodedata.category(c) != 'Mn')
    #$$ LANGUAGE plpython3u IMMUTABLE;"""
    #             query = """CREATE OR REPLACE FUNCTION normalize(mystr text)
    #   RETURNS text
    # AS $$
    #     from unidecode import unidecode
    #     return unidecode(mystr.decode("utf-8"))
    # $$ LANGUAGE plpythonu IMMUTABLE;"""
                query = """CREATE OR REPLACE FUNCTION normalize(text)
      RETURNS text
    AS $$
        use Text::Unidecode;
        return unidecode(shift);
    $$ LANGUAGE plperlu IMMUTABLE;"""
                self.execute_sql(query)
                self.commit()
                self.close_database()