Пример #1
0
    def _put_s3_dataset(self, _connection, s3_dataset_id, base_name, band,
                        bucket, macro_shape, chunk_size, numpy_type,
                        dimensions, regular_dims, regular_index,
                        irregular_index):
        """:type s3_dataset_id: uuid.UUID
        :type base_name: str
        :type band: str
        :type bucket: str
        :type macro_shape: array[int]
        :type chunk_size: array[int]
        :type numpy_type: str
        :type dimensions: array[str]
        :type regular_dims: array[bool]
        :type regular_index: array[array[float]]
        :type irregular_index: array[array[float]]"""
        res = _connection.execute(S3_DATASET.insert().values(
            id=s3_dataset_id,
            base_name=base_name,
            band=band,
            bucket=bucket,
            macro_shape=macro_shape,
            chunk_size=chunk_size,
            numpy_type=numpy_type,
            dimensions=dimensions,
            regular_dims=regular_dims,
            regular_index=regular_index,
            irregular_index=irregular_index))

        return res.inserted_primary_key[0]
Пример #2
0
 def _get_s3_dataset(self, _connection, dataset_ref, band):
     """:type dataset_ref: uuid.UUID
     :type band: str"""
     return _connection.execute(
         select([
             S3_DATASET.c.id, S3_DATASET.c.base_name, S3_DATASET.c.band,
             S3_DATASET.c.bucket, S3_DATASET.c.macro_shape,
             S3_DATASET.c.chunk_size, S3_DATASET.c.numpy_type,
             S3_DATASET.c.dimensions, S3_DATASET.c.regular_dims,
             S3_DATASET.c.regular_index, S3_DATASET.c.irregular_index
         ]).select_from(
             S3_DATASET.join(
                 S3_DATASET_MAPPING,
                 S3_DATASET_MAPPING.c.s3_dataset_id == S3_DATASET.c.id,
                 isouter=True)).where(
                     and_(S3_DATASET_MAPPING.c.dataset_ref == dataset_ref,
                          S3_DATASET_MAPPING.c.band == band))).fetchall()