Releases: cubewise-code/tm1py
1.5.0
Highlights
- Functions to pull TM1 data into PowerBI in a convenient shape. Allows building dashboards in PowerBI Desktop with refreshable TM1 data.
The execute_mdx
and execute_view
functions retrieve data from a cube.
with TM1Service(address="localhost", port=12354, user="admin", password="apple", ssl=True) as tm1:
data = tm1.power_bi.execute_view(cube_name="Sales", view_name="PowerBI", private=False)
Time | Industry | Executive | Customer | Business Unit | Product | State | Gross Margin | Revenue | COGS | |
---|---|---|---|---|---|---|---|---|---|---|
0 | 201308 | CPG | Andrew Ma | 10008 | 49 | 30 | TX | -5048.78 | nan | 5048.78 |
1 | 201308 | CPG | Andrew Ma | 10017 | 49 | 30 | NY | -5821.12 | nan | 5821.12 |
2 | 201308 | Energy | Valery Ushakov | 10035 | 31 | 50 | OH | -60384.4 | nan | 60384.4 |
3 | 201308 | Energy | Carlos Grilo | 10026 | 48 | 20 | FL | -24880 | nan | 24880 |
The get_member_properties
function retrieves a slice of a dimension.
with TM1Service(address="localhost", port=12354, user="admin", password="apple", ssl=True) as tm1:
customers = tm1.power_bi.get_member_properties(
dimension_name="Customer",
hierarchy_name="Customer",
member_selection="{Tm1SubsetAll([Customer])}",
skip_consolidations=True,
attributes=["State", "City"],
skip_parents=False)
Customer | Type | State | City | level000 | |
---|---|---|---|---|---|
0 | 1023 | Numeric | TX | Irving | Total Customer |
1 | 10000 | Numeric | IL | Chicago | Total Customer |
2 | 10001 | Numeric | IL | Westchester | Total Customer |
3 | 10002 | Numeric | TX | Plano | Total Customer |
4 | 10003 | Numeric | TX | Fort Worth | Total Customer |
- New
clear
method to efficiently zero out a slice of a cube, without need to write an MDX query or create a cube view.
with TM1Service(address="localhost", port=12354, user="admin", password="apple", ssl=True) as tm1:
tm1.cells.clear(cube="Sales", state="{[State].[CA]}", time="{[Time].[2020].Children}")
- Python Type Hints are now available on all functions and arguments. This enables autocompletion on all TM1py objects and makes working with TM1py way more friendly.
- New
async_requests_mode
to avoid 60s timeout when using TM1py with the IBM cloud #241
with TM1Service(
base_url='https://hostname.planning-analytics.ibmcloud.com/tm1/api/tm1_database_name/',
user="user",
namespace="LDAP",
password="xxxx",
ssl=True,
verify=True,
async_requests_mode=True) as tm1:
print(tm1.server.get_product_version())
- Added functions to
MonitoringService
to clear a TM1 instance from all user trafficcancel_all_threads
close_all_sessions
disconnect_all_users
New Features
- New function
execute_set_mdx
inElementService
allows to execute MDX set expressions. #205 - Add
add_edges
method to HierarchieService - Support execution of unbound TI processes #220
- Added
update_or_create
methods to all services - Added plain
clear_with_mdx
method toCellService
- Cube dimension re-order function
update_storage_dimension_order
now returns the percent change in memory footprint - Added
get_element_names
method toSubsetService
to retrieve element names from static or dynamic subsets - Added
user_exists
,group_exists
function toSecurityService
- Improved performance in
build_cellset_from_pandas_dataframe
function - Add
skip
argument to allexecute_view_
,execute_mdx_
functions - New
make_static
function in SubsetService #262 - Allow filtering of messagelog and transactionlog with
since
anduntil
timestamps #268 - Add
skip_zeros
,skip_consolidated
,skip_rule_derived
arguments to allexecute_mdx
andexecute_view
functions #273 - New simplified function in
ElementService
to retrieve elements with one attribute as dictionary:get_attribute_of_elements
- New function
execute_mdx_elements_value_dict
allows to retrieve data in dictionary with comma seperated element names as the key - New function
clear_spread
in CellService allows to execute a clear spread based on list unique element names. #207 - Support individual timeout on function call #117
Bug Fixes
- Fix timeout type issue #217
- Fix redundant calls in dimension update and create methods #229
- New improved
format_url
method to properly encode special characters in TM1 object names #212 - Add
type
andenabled
as properties toUser
class - Fix issue in
dst_chore_time
- Fix issue in
extract_cellset_dataframe
- Replace unofficial
/Content
REST API calls with official API calls #273 - Fix
check_rules
function to behave in line withcompile_process
function #277 - Encode % properly in object names #285
Compatibility Notes
By default, pandas will no longer be installed when installing TM1py with pip. #214
If you want to install tm1py with pandas, run:
pip install tm1py[pandas]
If a function requires pandas, but it isn't installed, TM1py will throw an ImportError
:
ImportError: Function 'get_member_properties' requires pandas
The MDXUtils
module has been deprecated. It still works but it throws a warning. It will be removed in the next major release of TM1py.
Please use MDXpy instead.
Acknowledgments
Big thanks to @rkvinoth, @scrambldchannel, @rclapp, @ykud, @zPat for contributing code to this release, and many others for reporting bugs and requesting features.
How to upgrade TM1py
To upgrade TM1py, just use the following command:
pip install TM1py --upgrade
1.4.1
1.4.0
Highlights
New create
, get
and delete
methods in ApplicationService
with TM1Service(address=ADDRESS, port=PORT, user=USER, password=PASSWORD, ssl=SSL) as tm1:
app = CubeApplication(path="Planning Sample", name="Sample Application", cube_name="Bike Shares")
tm1.applications.create(application=app, private=False)
with TM1Service(address=ADDRESS, port=PORT, user=USER, password=PASSWORD, ssl=SSL) as tm1:
with open(path_to_file, 'rb') as file:
app = DocumentApplication(path="Planning Sample", name="Sample Application", content=file.read())
tm1.applications.create(application=app, private=False)
New Features
- New
create
,get
,delete
methods for applications execute_view_dataframe
,execute_mdx_dataframe
methods now expose all arguments
from thepd.read_csv
methods (e.g.dtypes
,parse_dates
) #143
More details on the arguments here:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html- Add new method
remove_all_edges
toHierarchyService
to unwind hierarchy efficiently - New
get_element_identifiers
methods that returns all element names and alias values in aset
- Add
get_last_data_update
method toCubeService
#177 - Add
load
andunload
methods toCubeService
#163 - Add
check_rules
method toCubeService
Bug Fixes
- Fix issue in chore
update
method #133 and #134 - Fix handling of
Sandboxes
dimension when writing to cube #136 - Fix return of
extract_cellset_rows_and_values
method when MDX creates empty cellset #135 - Escape single quotes in all object names in odata references #145
- Undo silent type conversion in values column. Type of Value column in resulting dataframe from
execute_mdx_dataframe
,execute_view_dataframe
is derived from data, unless specified otherwise throughdtype
argument.
Compatibility Notes
ApplicationService
has been redesigned and is not backwards compatible.
Acknowledgments
Big thanks to @tombrzy , @ducklingasa , @rclapp , @pbuncik for contributing code to this release and many others for reporting bugs and requesting features.
How to upgrade TM1py
To upgrade TM1py, just use the following command:
pip install TM1py --upgrade
1.3.1
1.3.0
TM1py version 1.3.0 is now available. Getting started with TM1py
Enhancements
- TM1py now supports SSO authentication to TM1 using CAM gateway. Previously to connect to a TM1 instance with CAM security, you had to put your user name and passord in the configuration file as below:
[tm1srv01]
address=localhost
port=8884
user=vviau
password=YourPassword
namespace=CUBEWISE
ssl=True
Now you can replace your user and password with the new gateway
parameter such as below
[tm1srv02]
address=localhost
port=8884
namespace=CUBEWISE
gateway=http://localhost:80/ibmcognos/cgi-bin/cognos.cgi
ssl=True
TM1py will use your Windows login to authenticate with TM1. Thanks to adscheevel for adding this new feature to TM1py.
-
The
whoami
method has been added to get the user and group assignments, associated with your active session. #106 -
Get default element of a hierarchy without need to allocate full hierarchy in memory using the two new
HierarchyService
methods. #95:
get_default_member(dimension_name, hierarchy_name)
update_default_member(dimension_name, hierarchy_name, member_name)
-
New boolean parameter to enable base64 encoded passwords in the TM1Service constructor:
decode64
. #87 -
A new
remove_element(element_name)
method has been added to the Hierarchy class. It implicitly removes all edges from the hierarchy that are related to the element. #83 -
Introducing a new
skip_contexts (boolean)
argument in allexecute_mdx
functions to reduce the response size by omitting the title elements and thus speeds up the execution. #82 -
Two new methods have been added to the
CubeService
to query and update technical dimension order of a cube. #81 -
Updating a subset is now done entirely through the TM1 REST API instead of calling the
SubsetDeleteAllElements
TI function behind the scenes. #93 -
New argument in TM1Service constructor:
connection_pool_size
allows for a custom sized http connection pool. Required when using TM1py in a multithreaded environment. -
New method in CellService:
relative_proportional_spread
How to upgrade TM1py
To upgrade TM1py, just use the following command:
pip install TM1py --upgrade
1.2.0
TM1py version 1.2.0 is now available. Getting started with TM1py
Enhancements
- RestService - TM1py supports now base64 encoded password, TM1py is going to try first to connect using plain password, if authentication fails, it is going to retry authentication with b64decoded password. #66
- ServerService - New functions to get and update tm1s.cfg parameters live#76:
get_static_configuration
: get the configuration, as specified in the tm1s.cfg fileget_active_configuration
: get the configuration, as it currently applies in the TM1 Serverupdate_static_configuration
: update the configuration in the tm1s.cfg and trigger TM1 to re-read the file
- CellService - New functions to extract (pandas) pivot tables (in the shape of the view) from a cube view or MDX #74:
execute_view_dataframe_pivot
: get data from a cube viewexecute_mdx_dataframe_pivot
get data from MDX
- ViewService - new (dynamic)
get
method that returns MDX view or native view. #78 - ProcessService - New process execution functions#68:
execute_with_return
: execute a TM1 process and if process failed show the error.get_error_log_file_content
: get the content of error-log-files (e.g. TM1ProcessError_20180926213819_65708356_979b248b-232e622c6.log)
- ElementService - New functions to help managing elements #64:
get_elements
: get all elementsget_leaf_elements
: get all leaf elementsget_leaf_element_names
: get all leaf elements name
- TM1Service - New optional parameter for
session_context
, that controls what is displayed in the session column in Arc / Pulse / TM1top. Default value is "TM1py" #61 - New MDX parser to extract dimension composition from MDX query
- Improved test suite. Now all tests are deterministic and stand-alone. Success of tests no longer depends on execution order #72
Bugfixes
- Bugfix in default view format. Default view format is now: 0.#########
- Operations on users and groups (e.g.
add_user_to_groups
) are now case-and-space-insensitive - Update of dimension name on python object triggers name update of same-named-hierarchy in dimension #70
- Fix duplication of tasks when updating chores #69
How to upgrade TM1py
To upgrade TM1py, just use the following Python command:
- pip install TM1py --upgrade
1.1.0
Bugfixes:
- Remove variable_ui_data as well when removing variable from process
- Add new variables to process as type 'Other' instead of 'Ignore'
- Fix issue that cellsets would not be destroyed after usage
New Features
- New functions to retrieve TM1 data in a UI friendly format: execute_mdx_ui_dygraph, execute_mdx_ui_array
- Make tests compatible with TM1 11.3 (adapt to change in zero
suppression for calculated Members in MDX) - Prettify execute function. Execute function in ProcessService now takes TI Parameters as keyword arguments. Rename of name_process argument to process_name.
- Construct_mdx function in MDXUtils now more simple and robust
- More robust test cases for construct_mdx and underlying functions
1.0.3
New Stuff
- Get_cellset_cells_count function in CellService
- New optimized execute_mdx functions in CellService: execute_mdx_get_csv, execute_mdx_get_dataframe
- New get_members_under_consolidation function in ElementService
Improvements
- Improved Cellset handling when executing Views and MDX. Now always delete Cellsets after using them.
Bugfixes
- Documentation: http://tm1py.readthedocs.io/en/latest/
1.0.2
New stuff:
- TM1Object (Parent class of Subset, Process, Dimension, etc.) now has eq, ne magic methods. Allows to compare instances of Subset, Dimension, etc for equality with ==, =!
- RESTService can now be instantiated with 'session_id' parameter. Useful to avoid (unreasonably expensive) CAM Authentication when executing Python from another (REST) TM1 client
- Refactoring of RESTService
- get_cellset_cells_count function in CellService
- build_cellset_from_pandas_dataframe function in Utils class
- compile_process function added to ProcessService
- Tests now use config.ini file
- Execute_mdx_cell_values_only function to query cell-values only
1.0.1
- Construcor in RESTService / TM1Service now accepts string value for ssl parameter
- Update docstrings in Subsetservice
- Add pandas module to project dependencies
- Adjustments in subset_exists function. Now behaves like other exists functions
- Bugfix in hierarchycreation fallback (TI), when elementnames start with #