def free_aggregate_find( self, aggregator: FreeAggregator) -> List[Dict[str, Any]]: """ not supported by mongo """ raise UnexpectedStorageException( f'Method[free_aggregate_find] does not support by mongo storage.')
def find_table(table_name: str) -> Table: table = tables.get(table_name) if table is None: table = find_from_topic_tables(table_name) if table is None: raise UnexpectedStorageException( f'Table[{table_name}] definition not found.') return table
def begin(self) -> None: if self.connection is not None: raise UnexpectedStorageException( 'Connection exists, failed to begin another. It should be closed first.' ) self.connection = self.engine.connect() self.connection.begin()
def delete_only(self, deleter: EntityDeleter) -> int: """ delete only one, if delete none or more than one item, raise exception """ """ not supported by oss """ raise UnexpectedStorageException(f'Method[delete_only] does not support by oss storage.')
def update_one(self, one: Entity, helper: EntityIdHelper) -> int: """ returns 0 when update none, or 1 when update one """ """ not supported by oss """ raise UnexpectedStorageException(f'Method[update_one] does not support by oss storage.')
def update_only(self, updater: EntityUpdater, peace_when_zero: bool = False) -> int: """ update only one, if update none or more than one item, raise exception """ """ not supported by oss """ raise UnexpectedStorageException(f'Method[update_only] does not support by oss storage.')
def update_only_and_pull(self, updater: EntityUpdater) -> Optional[Entity]: """ update only one, if update none or more than one item, raise exception return the one before update """ """ not supported by oss """ raise UnexpectedStorageException(f'Method[update_only_and_pull] does not support by oss storage.')
def find_distinct_values(self, finder: EntityDistinctValuesFinder) -> EntityList: """ filled values with given distinct columns, returns an entity list. entity is deserialized by shaper """ """ not supported by oss """ raise UnexpectedStorageException(f'Method[find_distinct_values] does not support by oss storage.')
def delete_only_and_pull(self, deleter: EntityDeleter) -> Optional[Entity]: """ delete only one, if delete none or more than one item, raise exception return the one before delete """ """ not supported by S3 """ raise UnexpectedStorageException(f'Method[delete_only_and_pull] does not support by S3 storage.')
def find_straight_values(self, finder: EntityStraightValuesFinder) -> EntityList: """ fill values with given straight columns, returns an entity list entity will not be deserialized by shaper. And when there is aggregated columns, other columns will be used in group by """ """ not supported by oss """ raise UnexpectedStorageException(f'Method[find_straight_values] does not support by oss storage.')
def __init__(self, name: str, columns: List[MongoDocumentColumn]): self.name = name self.columns = columns id_columns = ArrayHelper(self.columns).filter( lambda x: x.columnType == MongoDocumentColumnType.ID).to_list() if len(id_columns) > 1: raise UnexpectedStorageException( f'Zero or one document id column expected, current is [{len(id_columns)}] for document[{name}].' ) elif len(id_columns) == 1: self.id_column = id_columns[0] else: self.id_column = None
def try_to_join(self, groups: Dict[TopicId, List[FreeJoin]], schemas: List[TrinoSchema], built: str = None) -> str: pending_groups: Dict[TopicId, List[FreeJoin]] = {} for primary_topic_id, joins_by_primary in groups.items(): primary_schema = self.find_schema_by_id(primary_topic_id) if built is not None and primary_schema not in schemas: # primary table not used, pending to next round pending_groups[primary_topic_id] = joins_by_primary else: groups_by_secondary: Dict[TopicId, List[FreeJoin]] = ArrayHelper(joins_by_primary) \ .group_by(lambda x: x.secondary.entityName) for secondary_topic_id, joins_by_secondary in groups_by_secondary.items( ): # every join is left join, otherwise reduce to inner join outer_join: bool = ArrayHelper(joins_by_secondary).every( lambda x: x.type == FreeJoinType.LEFT) secondary_schema = self.find_schema_by_id( secondary_topic_id) on: str = ArrayHelper( joins_by_secondary).map(lambda x: self.build_single_on( x, primary_schema, secondary_schema)).join(' AND ') join_operator = 'LEFT JOIN' if outer_join else 'INNER JOIN' if built is None: built = \ f'{primary_schema.get_entity_name()} AS {primary_schema.get_alias()} ' \ f'{join_operator} ' \ f'{secondary_schema.get_entity_name()} AS {secondary_schema.get_alias()} ON {on} ' else: built = \ f'{built} {join_operator} ' \ f'{secondary_schema.get_entity_name()} AS {secondary_schema.get_alias()} ON {on}' # append into used if secondary_schema not in schemas: schemas.append(secondary_schema) # append into used if primary_schema not in schemas: schemas.append(primary_schema) if len(pending_groups) == 0: # all groups consumed return built if len(pending_groups) == len(groups): # no groups can be consumed on this round raise UnexpectedStorageException( 'Cannot join tables by given declaration.') # at least one group consumed, do next round return self.try_to_join(pending_groups, schemas, built)
def build_free_aggregate_column(self, table_column: FreeAggregateColumn, index: int, prefix_name: str) -> Label: name = table_column.name alias = f'{prefix_name}_{index + 1}' arithmetic = table_column.arithmetic if arithmetic == FreeAggregateArithmetic.COUNT: return func.count(literal_column(name)).label(alias) elif arithmetic == FreeAggregateArithmetic.SUMMARY: return func.sum(literal_column(name)).label(alias) elif arithmetic == FreeAggregateArithmetic.AVERAGE: return func.avg(literal_column(name)).label(alias) elif arithmetic == FreeAggregateArithmetic.MAXIMUM: return func.max(literal_column(name)).label(alias) elif arithmetic == FreeAggregateArithmetic.MINIMUM: return func.min(literal_column(name)).label(alias) elif arithmetic == FreeAggregateArithmetic.NONE or arithmetic is None: return label(alias, literal_column(name)) else: raise UnexpectedStorageException(f'Aggregate arithmetic[{arithmetic}] is not supported.')
def acquire_engine_by_params(username: str, password: str, host: str, port: str, name: str, data_source_params: Optional[ List[DataSourceParam]], params: OracleDataSourceParams) -> Engine: sid = OracleDataSourceHelper.find_param(data_source_params, 'sid') if sid is not None: dsn = makedsn(host, port, sid=sid) elif is_not_blank(name): dsn = makedsn(host, port, service_name=name) else: service_name = OracleDataSourceHelper.find_param( data_source_params, 'service_name') if service_name is not None: dsn = makedsn(host, port, service_name=service_name) else: raise UnexpectedStorageException( f'Neither sid nor service_name exists, check oracle configuration please.' ) pool_size = OracleDataSourceHelper.find_param(data_source_params, 'pool_size') if pool_size is not None: parsed, pool_size = is_decimal(pool_size) if parsed: pool_size = int(pool_size) else: pool_size = 3 pool = SessionPool(user=username, password=password, dsn=dsn, min=pool_size, max=pool_size, increment=0, getmode=SPOOL_ATTRVAL_WAIT, encoding='UTF-8') return create_engine('oracle+cx_oracle://', creator=pool.acquire, poolclass=NullPool, coerce_to_decimal=False, echo=params.echo, optimize_limits=True, future=True)
def build_free_aggregate_column(self, table_column: FreeAggregateColumn, index: int, prefix_name: str) -> str: name = table_column.name alias = f'{prefix_name}_{index + 1}' arithmetic = table_column.arithmetic if arithmetic == FreeAggregateArithmetic.COUNT: return f'COUNT({name}) AS {alias}' elif arithmetic == FreeAggregateArithmetic.SUMMARY: return f'SUM({name}) AS {alias}' elif arithmetic == FreeAggregateArithmetic.AVERAGE: return f'AVG({name}) AS {alias}' elif arithmetic == FreeAggregateArithmetic.MAXIMUM: return f'MAX({name}) AS {alias}' elif arithmetic == FreeAggregateArithmetic.MINIMUM: return f'MIN({name}) AS {alias}' elif arithmetic == FreeAggregateArithmetic.NONE or arithmetic is None: return f'{name} AS {alias}' else: raise UnexpectedStorageException( f'Aggregate arithmetic[{arithmetic}] is not supported.')
def to_trino_type(column_type: MongoDocumentColumnType) -> str: if column_type == MongoDocumentColumnType.ID: return 'ObjectId' elif column_type == MongoDocumentColumnType.STRING: return 'varchar' elif column_type == MongoDocumentColumnType.NUMBER: decimal_integral_digits = ask_decimal_integral_digits() decimal_fraction_digits = ask_decimal_fraction_digits() return f'decimal({decimal_integral_digits}, {decimal_fraction_digits})' elif column_type == MongoDocumentColumnType.BOOLEAN: return 'boolean' elif column_type == MongoDocumentColumnType.DATE: return 'date' elif column_type == MongoDocumentColumnType.TIME: return 'time' elif column_type == MongoDocumentColumnType.DATETIME: return 'timestamp' elif column_type == MongoDocumentColumnType.OBJECT: return 'json' else: raise UnexpectedStorageException( f'Column type[{column_type}] is not supported in trino.')
def try_to_join(self, groups: Dict[TopicId, List[FreeJoin]], tables: List[Table], built=None) -> Join: pending_groups: Dict[TopicId, List[FreeJoin]] = {} for primary_entity_name, joins_by_primary in groups.items(): primary_table = self.find_table(primary_entity_name) if built is not None and primary_table not in tables: # primary table not used, pending to next round pending_groups[primary_entity_name] = joins_by_primary else: groups_by_secondary: Dict[TopicId, List[FreeJoin]] = ArrayHelper(joins_by_primary) \ .group_by(lambda x: x.secondary.entityName) for secondary_entity_name, joins_by_secondary in groups_by_secondary.items(): # every join is left join, otherwise reduce to inner join outer_join = ArrayHelper(joins_by_secondary).every(lambda x: x.type == FreeJoinType.LEFT) secondary_table = self.find_table(secondary_entity_name) on = and_( *ArrayHelper(joins_by_secondary).map( lambda x: self.build_single_on(x, primary_table, secondary_table)).to_list()) if built is None: built = primary_table.join(secondary_table, on, outer_join) else: built = built.join(secondary_table, on, outer_join) # append into used if secondary_table not in tables: tables.append(secondary_table) # append into used if primary_table not in tables: tables.append(primary_table) if len(pending_groups) == 0: # all groups consumed return built if len(pending_groups) == len(groups): # no groups can be consumed on this round raise UnexpectedStorageException('Cannot join tables by given declaration.') # at least one group consumed, do next round return self.try_to_join(pending_groups, tables, built)
def free_aggregate_page(self, pager: FreeAggregatePager) -> DataPage: """ not supported by mongo """ raise UnexpectedStorageException( f'Method[free_aggregate_page] does not support by mongo storage.')
def find(self, finder: EntityFinder) -> EntityList: """ not supported by oss """ raise UnexpectedStorageException(f'Method[find] does not support by oss storage.')
def find_all(self, helper: EntityHelper) -> EntityList: """ not supported by oss """ raise UnexpectedStorageException(f'Method[find_all] does not support by oss storage.')
def page(self, pager: EntityPager) -> DataPage: """ not supported by oss """ raise UnexpectedStorageException(f'Method[page] does not support by oss storage.')
def build_literal(tables: List[Table], a_literal: Literal, build_plain_value: Callable[[Any], Any] = None): if isinstance(a_literal, ColumnNameLiteral): if is_blank(a_literal.entityName): # table name is not given if len(tables) == 0: # in subquery, no table passed-in return literal_column(a_literal.columnName) elif len(tables) != 1: raise UnexpectedStorageException( 'Available table must be unique when entity name is missed in column name literal.') else: # noinspection PyPropertyAccess return tables[0].c[a_literal.columnName] else: table_name = as_table_name(a_literal.entityName) table = ArrayHelper(tables).find(lambda x: x.name == table_name) if table is None: raise UnexpectedStorageException(f'Entity[{a_literal.entityName}] not found.') return table.c[a_literal.columnName] elif isinstance(a_literal, ComputedLiteral): operator = a_literal.operator if operator == ComputedLiteralOperator.ADD: return ArrayHelper(a_literal.elements) \ .map(lambda x: build_literal(tables, x, to_decimal)) \ .reduce(lambda prev, current: prev + current, None) elif operator == ComputedLiteralOperator.SUBTRACT: return ArrayHelper(a_literal.elements) \ .map(lambda x: build_literal(tables, x, to_decimal)) \ .reduce(lambda prev, current: prev - current, None) elif operator == ComputedLiteralOperator.MULTIPLY: return ArrayHelper(a_literal.elements) \ .map(lambda x: build_literal(tables, x, to_decimal)) \ .reduce(lambda prev, current: prev * current, None) elif operator == ComputedLiteralOperator.DIVIDE: return ArrayHelper(a_literal.elements) \ .map(lambda x: build_literal(tables, x, to_decimal)) \ .reduce(lambda prev, current: prev / current, None) elif operator == ComputedLiteralOperator.MODULUS: return ArrayHelper(a_literal.elements) \ .map(lambda x: build_literal(tables, x, to_decimal)) \ .reduce(lambda prev, current: prev % current, None) elif operator == ComputedLiteralOperator.YEAR_OF: # year is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.year(build_literal(tables, a_literal.elements[0])) elif operator == ComputedLiteralOperator.HALF_YEAR_OF: # month is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return case(( func.month(build_literal(tables, a_literal.elements[0])) <= 6, DateTimeConstants.HALF_YEAR_FIRST.value), else_=DateTimeConstants.HALF_YEAR_SECOND.value ) elif operator == ComputedLiteralOperator.QUARTER_OF: # quarter is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.quarter(build_literal(tables, a_literal.elements[0])) elif operator == ComputedLiteralOperator.MONTH_OF: # month is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.month(build_literal(tables, a_literal.elements[0])) elif operator == ComputedLiteralOperator.WEEK_OF_YEAR: # week is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.week(build_literal(tables, a_literal.elements[0])) elif operator == ComputedLiteralOperator.WEEK_OF_MONTH: # weekofmonth is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.weekofmonth(build_literal(tables, a_literal.elements[0])) elif operator == ComputedLiteralOperator.DAY_OF_MONTH: # day is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.day(build_literal(tables, a_literal.elements[0])) elif operator == ComputedLiteralOperator.DAY_OF_WEEK: # weekday is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.weekday(build_literal(tables, a_literal.elements[0])) elif operator == ComputedLiteralOperator.CASE_THEN: elements = a_literal.elements cases = ArrayHelper(elements).filter(lambda x: isinstance(x, Tuple)) \ .map(lambda x: (build_criteria_statement(tables, x[0]), build_literal(tables, x[1]))) \ .to_list() anyway = ArrayHelper(elements).find(lambda x: not isinstance(x, Tuple)) if anyway is None: return case(*cases) else: return case(*cases, else_=build_literal(tables, anyway)) elif operator == ComputedLiteralOperator.CONCAT: literals = ArrayHelper(a_literal.elements).map(lambda x: build_literal(tables, x)).to_list() literal_count = len(literals) if literal_count == 1: return literals[0] elif literal_count == 2: return func.concat(literals[0], literals[1]) else: return ArrayHelper(a_literal.elements[2:]) \ .reduce(lambda prev, x: func.concat(prev, x), func.concat(literals[0], literals[1])) elif operator == ComputedLiteralOperator.YEAR_DIFF: # yeardiff is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.yeardiff( build_literal(tables, a_literal.elements[0]), build_literal(tables, a_literal.elements[1])) elif operator == ComputedLiteralOperator.MONTH_DIFF: # monthdiff is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.monthdiff( build_literal(tables, a_literal.elements[0]), build_literal(tables, a_literal.elements[1])) elif operator == ComputedLiteralOperator.DAY_DIFF: # datediff is a customized function, which can be found in data-scripts folder # make sure each topic storage have this function return func.datediff( build_literal(tables, a_literal.elements[0]), build_literal(tables, a_literal.elements[1])) elif operator == ComputedLiteralOperator.FORMAT_DATE: return func.to_char( build_literal(tables, a_literal.elements[0]), translate_date_format(a_literal.elements[1])) elif operator == ComputedLiteralOperator.CHAR_LENGTH: return func.length(func.ifnull(build_literal(tables, a_literal.elements[0]), '')) else: raise UnsupportedComputationException(f'Unsupported computation operator[{operator}].') elif isinstance(a_literal, datetime): return func.to_date(a_literal.strftime('%Y-%m-%d %H:%M:%S'), 'YYYY-MM-DD HH24:MI:SS') elif isinstance(a_literal, date): return func.to_date(a_literal.strftime('%Y-%m-%d'), 'YYYY-MM-DD') elif isinstance(a_literal, time): return func.to_date(a_literal.strftime('%H:%M:%S'), 'HH24:MI:SS') elif build_plain_value is not None: return build_plain_value(a_literal) else: # a value, return itself return a_literal
def exists(self, finder: EntityFinder) -> bool: """ not supported by oss """ raise UnexpectedStorageException(f'Method[exists] does not support by oss storage.')
def find_directory(name: str) -> str: directory = object_directory.get(name) if directory is None: raise UnexpectedStorageException( f'Table[{name}] definition not found.') return directory
def create_column(factor: Factor) -> MongoDocumentColumn: factor_name = '' if is_blank(factor.name) else factor.name.strip().lower() factor_type = factor.type if factor_type == FactorType.SEQUENCE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.NUMBER: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.UNSIGNED: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.TEXT: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.ADDRESS: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.CONTINENT: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.REGION: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.COUNTRY: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.PROVINCE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.CITY: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.DISTRICT: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.ROAD: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.COMMUNITY: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.FLOOR: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.RESIDENCE_TYPE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.RESIDENTIAL_AREA: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.EMAIL: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.PHONE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.MOBILE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.FAX: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.DATETIME: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.DATETIME, nullable=True) elif factor_type == FactorType.FULL_DATETIME: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.DATETIME, nullable=True) elif factor_type == FactorType.DATE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.DATE, nullable=True) elif factor_type == FactorType.TIME: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.TIME, nullable=True) elif factor_type == FactorType.YEAR: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.HALF_YEAR: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.QUARTER: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.MONTH: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.HALF_MONTH: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.TEN_DAYS: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.WEEK_OF_YEAR: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.WEEK_OF_MONTH: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.HALF_WEEK: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.DAY_OF_MONTH: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.DAY_OF_WEEK: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.DAY_KIND: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.HOUR: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.HOUR_KIND: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.MINUTE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.SECOND: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.MILLISECOND: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.AM_PM: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.GENDER: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.OCCUPATION: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.DATE_OF_BIRTH: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.DATETIME, nullable=True) elif factor_type == FactorType.AGE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.ID_NO: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.RELIGION: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.NATIONALITY: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.BIZ_TRADE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) elif factor_type == FactorType.BIZ_SCALE: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.NUMBER, nullable=True) elif factor_type == FactorType.BOOLEAN: return create_bool(factor_name) elif factor_type == FactorType.ENUM: return MongoDocumentColumn(factor_name, MongoDocumentColumnType.STRING, nullable=True) else: raise UnexpectedStorageException( f'Factor type[{factor_type}] is not supported.')
def update_and_pull(self, updater: EntityUpdater) -> EntityList: """ not supported by oss """ raise UnexpectedStorageException(f'Method[update_and_pull] does not support by oss storage.')
def update(self, updater: EntityUpdater) -> int: """ not supported by oss """ raise UnexpectedStorageException(f'Method[update] does not support by oss storage.')
def count(self, finder: EntityFinder) -> int: """ not supported by oss """ raise UnexpectedStorageException(f'Method[count] does not support by oss storage.')
def free_find(self, finder: FreeFinder) -> List[Dict[str, Any]]: """ not supported by oss """ raise UnexpectedStorageException(f'Method[free_find] does not support by oss storage.')
def free_page(self, pager: FreePager) -> DataPage: """ not supported by oss """ raise UnexpectedStorageException(f'Method[free_page] does not support by oss storage.')