MicroStrategy / mstrio-py

Python integration for MicroStrategy
Apache License 2.0
90 stars 60 forks source link

Issues exporting translations using to_csv_from_list #188

Open ChrisOakley0 opened 4 months ago

ChrisOakley0 commented 4 months ago

Hi,

I've been trying to use the new Translation.to_csv_from_list functionality that was recently updated in the March 2024 release, allowing for the languages to be specified rather than returning all languages.

Since the March 2024 update I've had issues with getting the object_list correct for this - it seems as if the function wants a list of entities (mstrio.utils.entity.Entity) now rather than just a list of dictionaries with ID and type.

When trying to create an entity from the first object in a full_search:

attribute_search = full_search(
    connection=conn,
    project=PROJECT_ID,
    name='',
    pattern=SearchPattern.CONTAINS,
    domain=2,
    root=FOLDER_ID,
    uses_object_type=ObjectTypes.ATTRIBUTE
)
attribute_entity = Entity(
    connection = conn,
    object_id = attribute_search[0]['id'],
    name = attribute_search[0]['name'],
    type = attribute_search[0]['type'],
    subtype = attribute_search[0]['subtype'],
    ext_type = attribute_search[0]['ext_type'],
    date_created = attribute_search[0]['date_created'],
    date_modified = attribute_search[0]['date_modified'],
    version = attribute_search[0]['version'],
    owner = attribute_search[0]['owner'],
    acg = attribute_search[0]['acg'],
    acl = attribute_search[0]['acl']
)

the following error is returned:

mstrio.helpers.IServerError: The query parameter 'type' is required but not provided. Please set a value for it.; code: 'ERR006', ticket_id: '9b886aa2a0144b1fa6e06b6638531d86'

It appears as if I'm not initializing the type parameter properly, but I haven't been able to find a way around it. How should I be going about generating an object_list for Translation.to_csv_from_list using a full_search? It would be really useful to be able to use the root and begin/end_modification_date filters on the full_search.

Thanks, Chris

xiakunhou commented 3 months ago

Looks like you miss another parameter object_types , while uses_object_type is for another purpose. Reference: https://www2.microstrategy.com/producthelp/Current/mstrio-py/mstrio.object_management.html