MicroStrategy / mstrio-py

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

class ObjectTypes(Enum) list is incomplete #116

Closed hustontrevor closed 1 year ago

hustontrevor commented 1 year ago

https://github.com/MicroStrategy/mstrio-py/blob/297ac7b60b11b74a5b1808caec87f91c035fa617/mstrio/types.py

https://www2.microstrategy.com/producthelp/Current/ReferenceFiles/reference/com/microstrategy/webapi/EnumDSSXMLObjectTypes.html

Below is failing when it encountered a Template object. Type should be 2, but None is returned.

File "C:\Users\adfafdsa\AppData\Local\Programs\Python\Python310\lib\site-packages\mstrio\utils\dependence_mixin.py", line 76, in list_dependents

mstrio.utils.helper.IServerError: Invalid value for 'usedByObject' or 'usesObject' parameter: '59BA48A948294B23EB2CBBAC6313EB16;None'. It should be: object Id;object type, for example: 'E02FE6DC430378A8BBD315AA791FC580;3'; code: 'ERR006', ticket_id: '08efbdc709d749d1958e2b2873fbe55c'

`def getDirectDependents(depns, obj, depth):

!! Attribute.list_dependents(uses_recursive=True) goes down to Table then back up, so it's useless. Need one at a time loop

# don't let higher schema objects drop back down to table level             
# want to avoid flow like table - attribute - fact - table - ... everything else dependent on the table         
# example: 31 dbconn/29 dbinstance/15 table1/12 attribute1/13 Fact1/15 table2/13 fact2/4 Metric2/3 Report2/ 
# Report2 is not an actual dependent of attribute1.         

dependents = obj.list_dependents(uses_recursive=False,to_dictionary=False)    
for d in dependents:
    # Not Schema or Schema Hierarchy
    if not ( d.id == 'A92B4BC0131145A0A2BE3DCD5D77F57C' or d.id == 'FD107ADDE8A948AE80F794A288FA70F4' ):
        # Not a Table if we're already above Tables
        if not ( obj.type.value in [1,3,12,13] and d.type.value == 15 ):                
            getDirectDependents(depns, d, depth+1)
            d.depth = depth
            depns.append(d)
return depns

`

urszulajaczewska commented 1 year ago

Hi @hustontrevor, in ObjectTypes we only have Enums supported by mstrio and we don't support Template object. However, we'll improve error handling for this case.

urszulajaczewska commented 1 year ago

Hi @hustontrevor, improved error handling is now available with 11.3.9.101 version.