Creates all the tables, and indexes needed for the service.

        :return: None
779273
def init_db(self):
        '''
        
        '''
        with self.conn.transaction() as t:
            t.execute('''
            CREATE TABLE temporal (
                tuid     INTEGER,
                revision CHAR(12) NOT NULL,
                file     TEXT,
                line     INTEGER
            );''')

            t.execute('''
            CREATE TABLE annotations (
                revision       CHAR(12) NOT NULL,
                file           TEXT,
                annotation     TEXT,
                PRIMARY KEY(revision, file)
            );''')

            # Used in frontier updating
            t.execute('''
            CREATE TABLE latestFileMod (
                file           TEXT,
                revision       CHAR(12) NOT NULL,
                PRIMARY KEY(file)
            );''')

            t.execute("CREATE UNIQUE INDEX temporal_rev_file ON temporal(revision, file, line)")
        Log.note("Tables created successfully")
143584
def set_up(self, reset=False):
        
        if reset:
            self.tear_down()

        logger.info("Creating database")
        # create the tables
        BASE.metadata.create_all(self.engine)
        return self
929434
def create_table(self, table, fields):
        
        table = table.get_soap_object(self.client)
        return self.call('createTable', table, fields)
1329232
def create(
            self,
            overwrite=False):
        
        logger.info("Creating database: %s", self.local_db_path)
        df = self._load_gtf_as_dataframe(
            usecols=self.restrict_gtf_columns,
            features=self.restrict_gtf_features)
        all_index_groups = self._all_possible_indices(df.columns)

        if self.restrict_gtf_features:
            feature_names = self.restrict_gtf_features
        else:
            # split single DataFrame into dictionary mapping each unique
            # feature name onto that subset of the data
            feature_names = df['feature'].unique()
        dataframes = {}
        # every table gets the same set of indices
        indices_dict = {}
        # if a feature has an ID then make it that table's primary key
        primary_keys = {}

        for feature in feature_names:
            df_subset = df[df.feature == feature]
            if len(df_subset) == 0:
                continue
            dataframes[feature] = df_subset

            primary_key = self._get_primary_key(feature, df_subset)
            if primary_key:
                primary_keys[feature] = primary_key

            indices_dict[feature] = self._feature_indices(
                all_index_groups,
                primary_key,
                df_subset)

        self._connection = datacache.db_from_dataframes_with_absolute_path(
            db_path=self.local_db_path,
            table_names_to_dataframes=dataframes,
            table_names_to_primary_keys=primary_keys,
            table_names_to_indices=indices_dict,
            overwrite=overwrite,
            version=DATABASE_SCHEMA_VERSION)
        return self._connection
103921
def create_table(cls, read_throughput=5, write_throughput=5):
        """"""
        table_name = cls.get_table_name()

        raw_throughput = {
            'ReadCapacityUnits': read_throughput,
            'WriteCapacityUnits': write_throughput
        }

        table_schema = []
        table_definitions = []
        seen_attrs = set()
        for key in cls._get_keys():
            table_schema.append(key.schema())
            table_definitions.append(key.definition())
            seen_attrs.add(key.name)

        indexes = []
        global_indexes = []
        for index in cls._get_indexes():
            if issubclass(index, GlobalIndex):
                global_indexes.append(index.schema())
            else:
                indexes.append(index.schema())
            for key in index._keys:
                if key.name not in seen_attrs:
                    table_definitions.append(key.definition())
                    seen_attrs.add(key.name)

        cls._get_connection().create_table(
            table_name=table_name,
            key_schema=table_schema,
            attribute_definitions=table_definitions,
            provisioned_throughput=raw_throughput,
            local_secondary_indexes=indexes or None,
            global_secondary_indexes=global_indexes or None
        )
865915
def tables(self):
        
        from .table import Table
        return [Table(tbl, self) for tbl in self._element.tbl_lst]
272166
def create_indexes(clas,pool_or_cursor):
    ""
    for index in clas.INDEXES:
      # note: these are specified as either 'field,field,field' or a runnable query. you can put any query you want in there
      query = index if 'create index' in index.lower() else 'create index on %s (%s)'%(clas.TABLE,index)
      commit_or_execute(pool_or_cursor,query)
559237
protected function createIndexes()
    {
        $this->createIndex(
            $this->db->getIndexName(TokensRecord::tableName(), 'providerId', false, true),
            TokensRecord::tableName(),
            'providerId',
            false
        );
    }
973859
def get_tables(self, table_name="", **kwargs):
        
        with self.connection(**kwargs) as connection:
            kwargs['connection'] = connection
            return self._get_tables(str(table_name), **kwargs)
801949
def init_tables
      # Do nothing if keyspace already exists
      if @cassandra.keyspaces.include?(@keyspace)
        @cassandra.keyspace = @keyspace
      else
        freq_table    = Cassandra::ColumnFamily.new({:keyspace => @keyspace, :name => "classes"}) # word  => {classname => count}
        summary_table = Cassandra::ColumnFamily.new({:keyspace => @keyspace, :name => "totals"})  # class => {wordcount => count}
        ks_def = Cassandra::Keyspace.new({
            :name               => @keyspace,
            :strategy_class     => 'org.apache.cassandra.locator.SimpleStrategy',
            :replication_factor => 1,
            :cf_defs            => [freq_table, summary_table] 
          })
        @cassandra.add_keyspace ks_def
        @cassandra.keyspace = @keyspace
      end
    end
1054086
def tables(self):
        
        cursor = self.connection.cursor()
        cursor.execute("show tables in %s" % self.db)
        self._tables = [t.Table(r[0], con=self.connection, db=self.db) for r in cursor.fetchall()]
        return self._tables
1133965
protected function createTables()
    {
        $this->createTable(TokensRecord::tableName(), [
            'id' => $this->primaryKey(),
            'accessToken' => $this->text()->notNull(),
            'refreshToken' => $this->text(),
            'providerId' => $this->integer()->notNull(),
            'values' => $this->text(),
            'enabled' => $this->boolean(),
            'dateExpires' => $this->dateTime(),
            'dateUpdated' => $this->dateTime()->notNull(),
            'dateCreated' => $this->dateTime()->notNull(),
            'uid' => $this->uid()
        ]);

        $this->createTable(ProviderRecord::tableName(), [
            'id' => $this->primaryKey(),
            'handle' => $this->string()->notNull(),
            'clientId' => $this->string(ProviderRecord::CLIENT_ID_LENGTH)->notNull(),
            'clientSecret' => $this->string(ProviderRecord::CLIENT_SECRET_LENGTH),
            'scopes' => $this->string(),
            'class' => $this->string()->notNull(),
            'settings' => $this->text(),
            'enabled' => $this->boolean(),
            'dateUpdated' => $this->dateTime()->notNull(),
            'dateCreated' => $this->dateTime()->notNull(),
            'uid' => $this->uid()
        ]);
    }
910791
protected function createTables()
    {
        $this->createTable(
            TransformerRecord::tableName(),
            [
                'id' => $this->primaryKey(),
                'handle' => $this->string()->notNull(),
                'class' => $this->string()->notNull(),
                'scope' => $this->string()->notNull(),
                'config' => $this->text(),
                'dateCreated' => $this->dateTime()->notNull(),
                'dateUpdated' => $this->dateTime()->notNull(),
                'uid' => $this->uid()
            ]
        );
    }
1152642
def create_table(self, names=None):
        

        scan_shape = (1,)
        for src in self._srcs:
            scan_shape = max(scan_shape, src['dloglike_scan'].shape)

        tab = create_source_table(scan_shape)
        for s in self._srcs:
            if names is not None and s.name not in names:
                continue
            s.add_to_table(tab)

        return tab
801285
def build_table(self):
        
        self.table = self.parent.tinydb.table(self.tablename)
451939
def build_from_table(self):
        
        table_parts = []

        # get the table sql for each table
        for table in self.tables:
            sql = table.get_sql()
            if len(sql):
                table_parts.append(sql)

        # combine all table sql separated by a comma
        sql = 'FROM {0} '.format(', '.join(table_parts))

        return sql
1226634
protected function createIndexes()
    {
        $this->createIndex(
            $this->db->getIndexName(
                TransformerRecord::tableName(),
                'handle',
                false,
                true
            ),
            TransformerRecord::tableName(),
            'handle',
            false
        );
        $this->createIndex(
            $this->db->getIndexName(
                TransformerRecord::tableName(),
                'handle',
                false
            ),
            TransformerRecord::tableName(),
            'handle',
            false
        );
        $this->createIndex(
            $this->db->getIndexName(
                TransformerRecord::tableName(),
                'handle,type,scope,context,siteId',
                true
            ),
            TransformerRecord::tableName(),
            'handle,type,scope,context,siteId',
            true
        );
        $this->createIndex(
            $this->db->getIndexName(
                TransformerRecord::tableName(),
                'siteId',
                false,
                true
            ),
            TransformerRecord::tableName(),
            'siteId',
            false
        );
    }