Ejemplo n.º 1
0
def _build_repeat_iteration_indicator(spec, context):
    return RawIndicator("base document iteration",
                        Column(
                            id="repeat_iteration",
                            datatype="integer",
                            is_nullable=False,
                            is_primary_key=True,
                        ),
                        getter=lambda doc, ctx: ctx.iteration)
Ejemplo n.º 2
0
def _build_inserted_at(spec, context):
    return RawIndicator("inserted at",
                        Column(
                            id="inserted_at",
                            datatype="datetime",
                            is_nullable=False,
                            is_primary_key=False,
                        ),
                        getter=lambda doc, ctx: ctx.inserted_timestamp)
Ejemplo n.º 3
0
def _build_raw_indicator(spec, context):
    wrapped = RawIndicatorSpec.wrap(spec)
    column = Column(
        id=wrapped.column_id,
        datatype=wrapped.datatype,
        is_nullable=wrapped.is_nullable,
        is_primary_key=wrapped.is_primary_key,
    )
    return RawIndicator(wrapped.display_name, column, getter=wrapped.getter)
Ejemplo n.º 4
0
 def to_ucr_column_spec(self):
     """
     :return: a UCR-compatible `Column` object that can be used to be converted to sqlalchemy tables
     """
     return Column(
         id=self.column_id,
         datatype=self.get_datatype(),
         is_nullable=self.is_nullable(),
         is_primary_key=self.is_primary_key(),
         create_index=self.create_index(),
     )
Ejemplo n.º 5
0
def _build_expression_indicator(spec, context):
    wrapped = ExpressionIndicatorSpec.wrap(spec)
    column = Column(
        id=wrapped.column_id,
        datatype=wrapped.datatype,
        is_nullable=wrapped.is_nullable,
        is_primary_key=wrapped.is_primary_key,
    )
    return RawIndicator(
        wrapped.display_name,
        column,
        getter=wrapped.parsed_expression(context),
    )