Create a new schema aware type.
513705
def make(class_name, base, schema):
    
    return type(class_name, (base,), dict(SCHEMA=schema))
586969
def create(cls, values, **context):
        
        schema = cls.schema()
        model = cls

        # check for creating inherited classes from a sub class
        polymorphic_columns = schema.columns(flags=orb.Column.Flags.Polymorphic)
        if polymorphic_columns:
            polymorphic_column = polymorphic_columns.values()[0]
            schema_name = values.get(polymorphic_column.name(), schema.name())
            if schema_name and schema_name != schema.name():
                schema = orb.system.schema(schema_name)
                if not schema:
                    raise orb.errors.ModelNotFound(schema=schema_name)
                else:
                    model = schema.model()

        column_values = {}
        collector_values = {}

        for key, value in values.items():
            obj = schema.collector(key) or schema.column(key)
            if isinstance(obj, orb.Collector):
                collector_values[key] = value
            else:
                column_values[key] = value

        # create the new record with column values (values stored on this record)
        record = model(context=orb.Context(**context))
        record.update(column_values)
        record.save()

        # save any collector values after the model is generated (values stored on other records)
        record.update(collector_values)

        return record
910093
def mapped_type(self, tchain, p_elem):
        """"""
        SchemaNode("data", p_elem).set_attr("type",
                                            self.datatype_map[tchain[0].arg])
491729
def create_schema(self):
        """"""
        execute = self.cursor.execute
        try:
            return execute('SELECT 1 FROM gauged_statistics')
        except self.psycopg2.ProgrammingError:
            pass
        self.db.rollback()
        execute("""CREATE TABLE IF NOT EXISTS gauged_data (
                namespace integer NOT NULL,
                "offset" integer NOT NULL,
                key bigint NOT NULL,
                data bytea NOT NULL,
                flags integer NOT NULL,
                PRIMARY KEY ("offset", namespace, key));
            CREATE TABLE IF NOT EXISTS gauged_keys (
                id serial PRIMARY KEY,
                namespace integer NOT NULL,
                key varchar NOT NULL);
            CREATE UNIQUE INDEX ON gauged_keys (
                namespace, key);
            CREATE OR REPLACE RULE gauged_ignore_duplicate_keys
                AS ON INSERT TO gauged_keys WHERE EXISTS (
                SELECT 1 FROM gauged_keys WHERE key = NEW.key
                    AND namespace = NEW.namespace)
                DO INSTEAD NOTHING;
            CREATE TABLE IF NOT EXISTS gauged_writer_history (
                id varchar PRIMARY KEY,
                timestamp bigint NOT NULL);
            CREATE TABLE IF NOT EXISTS gauged_cache (
                namespace integer NOT NULL,
                key bigint NOT NULL,
                "hash" bytea NOT NULL,
                length bigint NOT NULL,
                start bigint NOT NULL,
                value real,
                PRIMARY KEY(namespace, hash, length, start));
            CREATE OR REPLACE RULE gauged_ignore_duplicate_cache
                AS ON INSERT TO gauged_cache WHERE EXISTS (
                SELECT 1 FROM gauged_cache WHERE namespace = NEW.namespace AND
                "hash" = NEW.hash AND length = NEW.length
                AND start = NEW.start)
                DO INSTEAD NOTHING;
            CREATE TABLE IF NOT EXISTS gauged_statistics (
                namespace integer NOT NULL,
                "offset" integer NOT NULL,
                data_points integer NOT NULL,
                byte_count integer NOT NULL,
                PRIMARY KEY (namespace, "offset"));
            CREATE TABLE IF NOT EXISTS gauged_metadata (
                key varchar PRIMARY KEY,
                value varchar NOT NULL);
            CREATE OR REPLACE RULE gauged_ignore_duplicate_metadata
                AS ON INSERT TO gauged_metadata WHERE EXISTS (
                SELECT 1 FROM gauged_metadata WHERE key = NEW.key)
                DO INSTEAD NOTHING""")
        self.db.commit()
464236
def create_schema(self, check_if_exists=False, sync_schema=True,
                      verbosity=1):
        

        # safety check
        _check_schema_name(self.schema_name)
        cursor = connection.cursor()

        if check_if_exists and schema_exists(self.schema_name):
            return False

        # create the schema
        cursor.execute('CREATE SCHEMA %s' % self.schema_name)

        if sync_schema:
            call_command('migrate_schemas',
                         schema_name=self.schema_name,
                         interactive=False,
                         verbosity=verbosity)

        connection.set_schema_to_public()
666772
public static Builder newSchema(GraphQLSchema existingSchema) {
        return new Builder()
                .query(existingSchema.getQueryType())
                .mutation(existingSchema.getMutationType())
                .subscription(existingSchema.getSubscriptionType())
                .codeRegistry(existingSchema.getCodeRegistry())
                .clearAdditionalTypes()
                .clearDirectives()
                .additionalDirectives(existingSchema.directives)
                .additionalTypes(existingSchema.additionalTypes);
    }
971237
def _build_schema(self, s):
        
        w = self._whatis(s)
        if w == self.IS_LIST:
            w0 = self._whatis(s[0])
            js = {"type": "array",
                  "items": {"type": self._jstype(w0, s[0])}}
        elif w == self.IS_DICT:
            js = {"type": "object",
                  "properties": {key: self._build_schema(val) for key, val in s.items()}}
            req = [key for key, val in s.items() if not val.is_optional]
            if req:
                js["required"] = req
        else:
            js = {"type": self._jstype(w, s)}
        for k, v in self._json_schema_keys.items():
            if k not in js:
                js[k] = v
        return js
1156908
def build_schema(
    source: Union[str, Source],
    assume_valid=False,
    assume_valid_sdl=False,
    no_location=False,
    experimental_fragment_variables=False,
) -> GraphQLSchema:
    """"""
    return build_ast_schema(
        parse(
            source,
            no_location=no_location,
            experimental_fragment_variables=experimental_fragment_variables,
        ),
        assume_valid=assume_valid,
        assume_valid_sdl=assume_valid_sdl,
    )
463193
public static <T> Schema<T> createFrom(RuntimeSchema<T> rs,
            Factory vf, Predicate.Factory pf,
            String... args)
    {
        return createFrom(rs, rs.instantiator, vf, pf, args);
    }
1121728
def add_schema(self, schema):
        

        # serialize instances of SchemaNode before parsing
        if isinstance(schema, SchemaNode):
            schema = schema.to_schema()

        for subschema in self._get_subschemas(schema):
            # delegate to SchemaType object
            schema_generator = self._get_generator_for_schema(subschema)
            schema_generator.add_schema(subschema)

        # return self for easy method chaining
        return self
1160017
def build(_resource, _cache=True, **kwargs):
    
    return _SCHEMAFACTORY.build(_resource=_resource, _cache=True, **kwargs)
528420
def create(client, _type, **kwargs):
    """"""
    obj = client.factory.create("ns0:%s" % _type)
    for key, value in kwargs.items():
        setattr(obj, key, value)
    return obj
365546
public static <T> Schema<T> createFrom(RuntimeSchema<T> ms,
            Instantiator<T> instantiator,
            Factory vf,
            Predicate.Factory pf,
            String... args)
    {
        return vf.create(ms, instantiator, pf, args);
    }
89154
def _pull_schema_definition(self, fname):
        """"""
        std_url = urlopen(self._ontology_file)
        cached_std = open(fname, "w+")
        cached_std.write(std_url.read())
        cached_std.close()
1318105
private List<SchemaDescriptor> createSchemas(Catalog catalog, Store store) throws IOException {
        List<SchemaDescriptor> schemaDescriptors = new ArrayList<>();
        Map<String, ColumnTypeDescriptor> columnTypes = new HashMap<>();
        Map<Column, ColumnDescriptor> allColumns = new HashMap<>();
        Set<ForeignKey> allForeignKeys = new HashSet<>();
        for (Schema schema : catalog.getSchemas()) {
            SchemaDescriptor schemaDescriptor = store.create(SchemaDescriptor.class);
            schemaDescriptor.setName(schema.getName());
            // Tables
            createTables(catalog, schema, schemaDescriptor, columnTypes, allColumns, allForeignKeys, store);
            // Sequences
            createSequences(catalog.getSequences(schema), schemaDescriptor, store);
            // Procedures and Functions
            createRoutines(catalog.getRoutines(schema), schemaDescriptor, columnTypes, store);
            schemaDescriptors.add(schemaDescriptor);
        }
        // Foreign keys
        createForeignKeys(allForeignKeys, allColumns, store);
        return schemaDescriptors;
    }
637336
private void createSchema() throws SQLException {
		logger.entering(CLASSNAME, "createSchema");
		Connection conn = getConnectionToDefaultSchema();

		logger.log(Level.INFO, schema + " schema does not exists. Trying to create it.");
		PreparedStatement ps = null;
		ps = conn.prepareStatement("CREATE SCHEMA " + schema);
		ps.execute();

		cleanupConnection(conn, null, ps);
		logger.exiting(CLASSNAME, "createSchema");
	}
979258
public HsqlName newAutoName(String prefix, HsqlName schema,
                                HsqlName parent, int type) {

        HsqlName name = newAutoName(prefix, (String) null, schema, parent,
                                    type);

        return name;
    }