Check if schema exists
327370
def schema_exists(cls, cur, schema_name):
        
        cur.execute("SELECT EXISTS (SELECT schema_name FROM information_schema.schemata WHERE schema_name = '{0}');"
                    .format(schema_name))
        return cur.fetchone()[0]
186930
def exists(self, filename):
        """"""
        client = boto3.client("s3")
        bucket, path = self.bucket_and_path(filename)
        r = client.list_objects(Bucket=bucket, Prefix=path, Delimiter="/")
        if r.get("Contents") or r.get("CommonPrefixes"):
            return True
        return False
878622
def exists(self, record_key):
        
        ''' 
            
        '''
        
        title = '%s.exists' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # send get metadata request
        file_path = '/%s' % record_key
        try:
            self.dropbox.files_get_metadata(file_path)
        except Exception as err:
            if str(err).find("LookupError('not_found'") > -1:
                return False
            else:
                raise DropboxConnectionError(title)

        return True
1245203
private function typeExists(string $schema, string $typeName) : bool
    {
        if (!$this->schemaExists($schema)) {
            return false;
        }

        return array_key_exists($typeName, $this->storage[$schema]);
    }
1160999
def assert_valid_schema(schema: GraphQLSchema) -> None:
    
    errors = validate_schema(schema)
    if errors:
        raise TypeError("\n\n".join(error.message for error in errors))
36992
def ensure_schema(value, child_schema)
      if value.present? && child_schema.present?
        value = if child_schema.is_a?(Array)
                  value.map do |item|
                    item.is_a?(SchemaModel) ? item : child_schema[0].new(item)
                  end
                else
                  value.is_a?(SchemaModel) ? value : child_schema.new(value)
                end
      end

      value
    end
476431
public boolean matchJsonToSchema(JSONObject schema, JSONObject json) throws Exception {
        SchemaLoader.builder()
                 .useDefaults(true)
                 .schemaJson(schema)
                 .build()
                 .load()
                 .build()
                 .validate(json);
        return true;
    }
219456
public function exists()
    {
        $sql = 'SELECT count(*) FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name=? ';
        $params = array($this->_name->table);

        if (is_null($this->_name->database)) {
            $sql .= 'AND TABLE_SCHEMA=database() ';
        } else {
            $sql .= 'AND TABLE_SCHEMA=? ';
            $params []= $this->_name->database;
        }

        return (bool) $this->_connection->execute($sql, $params)->scalar();
    }
609267
def validation_schema(name):
    """"""
    schemas = {
        'processor': 'processSchema.json',
        'descriptor': 'descriptorSchema.json',
        'field': 'fieldSchema.json',
        'type': 'typeSchema.json',
    }

    if name not in schemas:
        raise ValueError()

    field_schema_file = finders.find('flow/{}'.format(schemas['field']), all=True)[0]
    with open(field_schema_file, 'r') as fn:
        field_schema = fn.read()

    if name == 'field':
        return json.loads(field_schema.replace('{{PARENT}}', ''))

    schema_file = finders.find('flow/{}'.format(schemas[name]), all=True)[0]
    with open(schema_file, 'r') as fn:
        schema = fn.read()

    return json.loads(schema.replace('{{FIELD}}', field_schema).replace('{{PARENT}}', '/field'))
511957
def exists(self, query, **args):
        
        return bool(self.find(query, **args).limit(1).count())
844378
function schemaType(schema) {
    let type;
    if (schema.hasOwnProperty('type')) {
        type = schema.type;
    } else if (schema.hasOwnProperty('properties') || schema.hasOwnProperty('allOf') || schema.hasOwnProperty('additionalProperties')) {
        type = 'object';
    } else if (schema.hasOwnProperty('items')) {
        type = 'array';
    }

    switch (type) {
        case 'array':
        case 'boolean':
        case 'file':
        case 'integer':
        case 'number':
        case 'object':
        case 'string':
            return type;
    }
}
207485
def exists(self):
        
        try:
            key = self.key
        except DoesNotExist:
            """
            If the object doesn't exists anymore, its PK is deleted, so the
            "self.key" call will raise a DoesNotExist exception. We catch it
            to return False, as the field doesn't exists too.
            """
            return False
        else:
            return self.connection.exists(key)
818225
def exists(self):
        """"""
        try:
            self.cc.sql_client.send(
                'EXPLAIN SELECT * FROM "{table_name}"'.format(
                    table_name=self.table_name),
                do_post=False)
            return True
        except CartoException as err:
            # If table doesn't exist, we get an error from the SQL API
            self.cc._debug_print(err=err)
            return False
1193932
def ensure_schema(self):
        """"""
        self._ensure_filename()
        if not os.path.isfile(self.filename):
            self.create_schema()
938929
def exists(self, model_class, ID):
        ''''''

        assert hasattr(model_class, '_fields'), 'Not a valid model class'
        res = self.get(model_class, id=ID, fetchOne=True)
        if res:
            return True
        return False
931707
def _load_schemas(self):
        """"""
        for filename in os.listdir(self.settings['SCHEMA_DIR']):
            if filename[-4:] == 'json':
                name = filename[:-5]
                with open(self.settings['SCHEMA_DIR'] + filename) as the_file:
                    self.schemas[name] = json.load(the_file)
                    self.logger.debug("Successfully loaded " + filename + " schema")
78348
def exists(self):
        """"""

        try:
            self.s3_object.load()
            return True
        except botocore.exceptions.ClientError: return False