Beispiel #1
0
from mara_schema.attribute import Type
from mara_schema.entity import Entity

customer_entity = Entity(
    name='Customer',
    description=
    'People that made at least one order or that subscribed to the newsletter',
    schema_name='dim')

customer_entity.add_attribute(
    name='Customer ID',
    description='The ID of the customer as defined in the backend',
    column_name='customer_id',
    type=Type.ID,
    high_cardinality=True,
    important_field=True)

customer_entity.add_attribute(name='Email',
                              description='The email of the customer',
                              column_name='email',
                              personal_data=True,
                              high_cardinality=True,
                              accessible_via_entity_link=False)

customer_entity.add_attribute(
    name='Duration since first order',
    description='The number of days since the first order was placed',
    type=Type.DURATION,
    column_name='duration_since_first_order',
    accessible_via_entity_link=False)
Beispiel #2
0
from mara_schema.entity import Entity
from mara_schema.attribute import Type

seller_entity = Entity(name='Seller',
                       description='Merchants that are selling products',
                       schema_name='ec_dim')

seller_entity.add_attribute(
    name='Seller ID',
    description='The ID of the seller as defined in the backend',
    column_name='seller_id',
    type=Type.ID,
    high_cardinality=True)

from .zip_code import zip_code_entity
from .order import order_entity

seller_entity.link_entity(target_entity=zip_code_entity,
                          prefix='',
                          fk_column='zip_code_fk',
                          description='The ZIP code info of the seller')
seller_entity.link_entity(
    target_entity=order_entity,
    fk_column='first_order_fk',
    prefix='First order',
    description='The first order fulfilled by the seller')
Beispiel #3
0
from mara_schema.entity import Entity
from mara_schema.attribute import Type

zip_code_entity = Entity(
    name='Zip code',
    description='Information on Brazilian zip codes including coordinates',
    schema_name='ec_dim',
    table_name='zip_code')

zip_code_entity.add_attribute(
    name='Zip code ID',
    description=
    'Unique identifier of a geo-location entry based on the zip code',
    column_name='zip_code_id',
    type=Type.ID)

zip_code_entity.add_attribute(
    name='Zip code',
    description='First 5 digits of the zip code (Brazil has an 8-digit system)',
    column_name='zip_code')

zip_code_entity.add_attribute(name='Latitude',
                              description='Latitude coordinate',
                              column_name='latitude')

zip_code_entity.add_attribute(name='Longitude',
                              description='Longitude coordinate',
                              column_name='longitude')

zip_code_entity.add_attribute(name='City',
                              description='City name',
Beispiel #4
0
from mara_schema.entity import Entity
from mara_schema.attribute import Type

lead_entity = Entity(
    name='Lead',
    description="People that made contact through filling a request of contact on a landing page. Can become "
                "sellers if they close a deal with a Sales Representative",
    schema_name='m_dim',
    table_name='lead')

lead_entity.add_attribute(
    name='Lead ID',
    description='The ID of the lead as defined in the backend',
    column_name='lead_id',
    type=Type.ID,
    high_cardinality=True)

lead_entity.add_attribute(
    name='First contact date',
    description='The date the lead made first contact by signing up on a landing page',
    column_name='first_contact_date',
    important_field=True,
    type=Type.DATE)

lead_entity.add_attribute(
    name='Is closed deal',
    description='Whether the qualified lead closed a deal with a Sales Representative and became a seller',
    column_name='is_closed_deal',
    type=Type.ENUM,
    important_field=True)
Beispiel #5
0
from mara_schema.entity import Entity
from mara_schema.attribute import Type

order_entity = Entity(
    name='Order',
    description='Valid orders for which an invoice was created',
    schema_name='ec_dim')

order_entity.add_attribute(
    name='Order ID',
    description='The ID of the order in the backend',
    column_name='order_id',
    type=Type.ID,
    high_cardinality=True)

order_entity.add_attribute(
    name='Order date',
    description='The date when the order was placed (stored in the backend)',
    column_name='order_date',
    important_field=True,
    type=Type.DATE)

order_entity.add_attribute(
    name='Order status',
    description='The current status of the order (created, approved, shipped, etc)',
    column_name='order_status',
    type=Type.ENUM)

order_entity.add_attribute(
    name='Payment approval date',
    description='The date when the customer\'s payment was approved by the seller',
from mara_schema.entity import Entity
from mara_schema.attribute import Type

order_item_entity = Entity(
    name='Order item',
    description='Individual products sold as part of an order',
    schema_name='ec_dim',
    table_name='order_item')

order_item_entity.add_attribute(
    name='Order item ID',
    description='The ID of the order item in the backend',
    column_name='order_item_id',
    type=Type.ID,
    high_cardinality=True)

from .order import order_entity
from .product import product_entity
from .seller import seller_entity

order_item_entity.link_entity(target_entity=product_entity,
                              description="The product that was ordered")
order_item_entity.link_entity(
    target_entity=order_entity,
    description="The order that contains the order item",
    prefix='')
order_item_entity.link_entity(target_entity=seller_entity,
                              description='The seller who fulfills the order')
Beispiel #7
0
from mara_schema.entity import Entity
from mara_schema.attribute import Type

product_entity = Entity(name='Product',
                        description='Products that were at least sold once',
                        schema_name='ec_dim')

product_entity.add_attribute(
    name='Product ID',
    description='The ID of the product as defined in the PIM system',
    column_name='product_id',
    type=Type.ID,
    high_cardinality=True)

product_entity.add_attribute(
    name='Product category',
    description=
    'The category name describing the group of products (e.g. "health_beauty", '
    '"computers_accessories", etc.',
    column_name='product_category',
    important_field=True,
    type=Type.ENUM)

product_entity.add_attribute(
    name='Weight',
    description='The weight of the product measured in grams',
    column_name='weight')

product_entity.add_attribute(
    name='Length',
    description='The length of the product measured in centimeters',
from mara_schema.entity import Entity
from mara_schema.attribute import Type

customer_entity = Entity(
    name='Customer',
    description='People that made at least one order',
    schema_name='ec_dim')

customer_entity.add_attribute(
    name='Customer ID',
    description='The ID of the customer as defined in the backend',
    column_name='customer_id',
    type=Type.ID,
    high_cardinality=True)

customer_entity.add_attribute(
    name='Days since first order',
    description='The number of days since the first order was placed',
    type=Type.DURATION,
    column_name='days_since_first_order',
    accessible_via_entity_link=False)

customer_entity.add_attribute(
    name='Days since last order',
    description='The number of days since the last order was placed',
    type=Type.DURATION,
    column_name='days_since_last_order',
    accessible_via_entity_link=False)

customer_entity.add_attribute(
    name='Favourite product category',
Beispiel #9
0
from mara_schema.attribute import Type
from mara_schema.entity import Entity

order_entity = Entity(
    name='Order',
    description='Valid orders for which an invoice was created',
    schema_name='dim')

order_entity.add_attribute(
    name='Order ID',
    description='The invoice number of the order as stored in the backend',
    column_name='order_id',
    type=Type.ID,
    important_field=True,
    high_cardinality=True)

order_entity.add_attribute(
    name='Order date',
    description='The date when the order was placed (stored in the backend)',
    column_name='order_date',
    type=Type.DATE,
    important_field=True)

order_entity.add_attribute(
    name='Status',
    description='The current status of the order (new, paid, shipped, etc.)',
    column_name='status',
    accessible_via_entity_link=False,
    type=Type.ENUM)

from .customer import customer_entity
Beispiel #10
0
from mara_schema.entity import Entity, Type

product_entity = Entity(
    name='Product',
    description='Products that were at least once sold or once on stock',
    schema_name='dim')

product_entity.add_attribute(
    name='SKU',
    description='The ID of a product as defined in the PIM system',
    high_cardinality=True,
    column_name='sku',
    type=Type.ID)

from .product_category import product_category_entity

product_entity.link_entity(target_entity=product_category_entity)
from mara_schema.entity import Entity

product_category_entity = Entity(
    name='Product category',
    description=
    'A broad categorization of products as defined by the purchasing team',
    schema_name='dim')

product_category_entity.add_attribute(
    name='Level 1',
    description='One of the 6 main product categories',
    column_name='main_category')

product_category_entity.add_attribute(
    name='Level 2',
    description='The second level category of a product',
    column_name='sub_category_1')
Beispiel #12
0
from mara_schema.attribute import Type
from mara_schema.entity import Entity

order_item_entity = Entity(
    name='Order item',
    description='Individual products sold as part of an order',
    schema_name='dim')

order_item_entity.add_attribute(
    name='Order item ID',
    description='The ID of the order item in the backend',
    column_name='order_item_id',
    type=Type.ID,
    high_cardinality=True)

from .order import order_entity
from .product import product_entity

order_item_entity.link_entity(target_entity=order_entity, prefix='')
order_item_entity.link_entity(target_entity=product_entity)