CellService
CellService(tm1_rest)
Bases: ObjectService
Service to handle Read and Write operations to TM1 cubes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tm1_rest
|
RestService
|
instance of RestService |
required |
Source code in TM1py/Services/CellService.py
activate_transactionlog(*args, **kwargs)
Activate Transactionlog for one or many cubes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
str
|
one or many cube names |
()
|
Returns:
| Type | Description |
|---|---|
Response
|
|
Source code in TM1py/Services/CellService.py
begin_changeset()
check_cell_feeders(cube_name, elements, dimensions=None, sandbox_name=None, element_separator=',', hierarchy_separator='&&', hierarchy_element_separator='::', **kwargs)
Check feeders
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
name of the target cube |
required |
elements
|
Union[Iterable, str]
|
string "Hierarchy1::Element1 && Hierarchy2::Element4, Element9, Element2" - Dimensions are not specified! They are derived from the position. - The , separates the element-selections - If more than one hierarchy is selected per dimension && splits the elementselections - If no Hierarchy is specified. Default Hierarchy will be addressed or Iterable [Element1, Element2, Element3] |
required |
dimensions
|
Iterable[str]
|
optional. Dimension names in their natural order. Will speed up the execution! |
None
|
sandbox_name
|
str
|
str |
None
|
element_separator
|
str
|
Alternative separator for the elements, if elements are passed as string |
','
|
hierarchy_separator
|
str
|
Alternative separator for multiple hierarchies, if elements are passed as string |
'&&'
|
hierarchy_element_separator
|
str
|
Alternative separator between hierarchy name and element name, if elements are passed as string |
'::'
|
Returns:
| Type | Description |
|---|---|
Dict
|
fed cell descriptor |
Source code in TM1py/Services/CellService.py
clear(cube, **kwargs)
Takes the cube name and keyword argument pairs of dimensions and MDX expressions:
tm1.cells.clear(
cube="Sales",
salesregion="{[Sales Region].[Australia],[Sales Region].[New Zealand]}",
product="{[Product].[ABC]}",
time="{[Time].[2022].Children}")
Make sure that the keyword argument names (e.g. product) map with the dimension names (e.g. Product) in the cube. Spaces in the dimension name (e.g., "Sales Region") must be omitted in the keyword (e.g. "salesregion")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
str
|
name of the cube |
required |
kwargs
|
keyword argument pairs of dimension names and mdx set expressions |
{}
|
Returns:
| Type | Description |
|---|---|
|
|
Source code in TM1py/Services/CellService.py
clear_spread(cube, unique_element_names, sandbox_name=None, **kwargs)
Execute clear spread
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
str
|
name of the cube |
required |
unique_element_names
|
Iterable[str]
|
target cell coordinates as unique element names (e.g. ["[d1].[c1]","[d2].[e3]"]) |
required |
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
Response
|
|
Source code in TM1py/Services/CellService.py
clear_with_dataframe(cube, df, dimension_mapping=None, **kwargs)
Clears data from a TM1 cube based on the distinct values in a DataFrame over cube dimensions.
Note:
This function is similar to tm1.cells.clear, but it is designed specifically for clearing data
based on distinct values in a DataFrame over cube dimensions. The key difference is that this
function interprets the DataFrame columns as dimensions and supports a mapping (dimension_mapping)
for specifying hierarchies within those dimensions.
:example:
# Sample DataFrame with distinct values over cube dimensions
data = {
"Year": ["2021", "2022"],
"Organisation": ["some_company", "some_company"],
"Location": ["Germany", "Albania"]
}
# Sample dimension mapping
dimensions_mapping = {
"Organisation": "hierarchy_1",
"Location": ["hierarchy_2", "hierarchy_3", "hierarchy_4"]
}
dataframe = pd.DataFrame(data)
with TM1Service(**tm1params) as tm1:
tm1.cells.clear_with_dataframe(cube="Sales", df=dataframe)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
str
|
str The name of the TM1 cube. |
required |
df
|
DataFrame
|
pd.DataFrame The DataFrame containing distinct values over cube dimensions. Columns in the DataFrame should correspond to cube dimensions. |
required |
dimension_mapping
|
Dict
|
Dict, optional A dictionary mapping the DataFrame columns to one or many hierarchies within the given dimension. If not provided, assumes that the dimensions have just one hierarchy. |
None
|
Returns:
| Type | Description |
|---|---|
|
None The function clears data in the specified TM1 cube. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If there are unmatched dimensions in the DataFrame or if specified dimensions do not exist in the TM1 cube. |
Source code in TM1py/Services/CellService.py
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | |
clear_with_mdx(cube, mdx, sandbox_name=None, **kwargs)
clear a slice in a cube based on an MDX query.
Function requires admin permissions, since TM1py uses an unbound TI with a ViewZeroOut statement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
str
|
name of the cube |
required |
mdx
|
str
|
a valid MDX query |
required |
sandbox_name
|
str
|
a valid existing sandbox for the current user |
None
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
|
|
Source code in TM1py/Services/CellService.py
create_cellset(mdx, sandbox_name=None, **kwargs)
Execute MDX in order to create cellset at server. return the cellset-id
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
Union[str, MdxBuilder]
|
MDX Query, as string |
required |
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in TM1py/Services/CellService.py
create_cellset_from_view(cube_name, view_name, private, sandbox_name=None, **kwargs)
create cellset from a cube view. return the cellset-id
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
required |
kwargs
|
|
{}
|
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
str
|
|
Source code in TM1py/Services/CellService.py
deactivate_transactionlog(*args, **kwargs)
Deactivate Transactionlog for one or many cubes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
str
|
one or many cube names |
()
|
Returns:
| Type | Description |
|---|---|
Response
|
|
Source code in TM1py/Services/CellService.py
delete_cellset(cellset_id, sandbox_name=None, **kwargs)
Delete a cellset
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
|
required |
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
Response
|
|
Source code in TM1py/Services/CellService.py
drop_non_updateable_cells(cells, cube_name, dimensions)
Source code in TM1py/Services/CellService.py
end_changeset(change_set)
end a change set
Returns:
| Type | Description |
|---|---|
Response
|
Change set ID |
Source code in TM1py/Services/CellService.py
execute_mdx(mdx, cell_properties=None, top=None, skip_contexts=False, skip=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, element_unique_names=True, skip_cell_properties=False, use_compact_json=False, skip_sandbox_dimension=False, max_workers=1, async_axis=0, **kwargs)
Execute MDX and return the cells with their properties
:skip_sandbox_dimension: bool = False
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
MDX Query, as string |
required |
cell_properties
|
List[str]
|
properties to be queried from the cell. E.g. Value, Ordinal, RuleDerived, ... |
None
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_contexts
|
bool
|
skip elements from titles / contexts in response |
False
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
element_unique_names
|
bool
|
'[d1].[h1].[e1]' or 'e1' |
True
|
skip_cell_properties
|
bool
|
cell values in result dictionary, instead of cell_properties dictionary |
False
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
content in sweet concise structure. |
Source code in TM1py/Services/CellService.py
2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 | |
execute_mdx_async(mdx, cell_properties=None, top=None, skip_contexts=False, skip=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, element_unique_names=True, skip_cell_properties=False, use_compact_json=False, skip_sandbox_dimension=False, max_workers=8, async_axis=0, **kwargs)
Execute MDX and return the cells with their properties
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
MDX Query, as string |
required |
cell_properties
|
List[str]
|
properties to be queried from the cell. E.g. Value, Ordinal, RuleDerived, ... |
None
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_contexts
|
bool
|
skip elements from titles / contexts in response |
False
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
element_unique_names
|
bool
|
'[d1].[h1].[e1]' or 'e1' |
True
|
skip_cell_properties
|
bool
|
cell values in result dictionary, instead of cell_properties dictionary |
False
|
use_compact_json
|
bool
|
bool |
False
|
skip_sandbox_dimension
|
bool
|
bool = False |
False
|
max_workers
|
int
|
Int, number of threads to use in parallel |
8
|
async_axis
|
int
|
0 (columns) or 1 (rows). On which axis to parallelize retrieval |
0
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
content in sweet concise structure. |
Source code in TM1py/Services/CellService.py
execute_mdx_cellcount(mdx, sandbox_name=None, **kwargs)
Execute MDX in order to understand how many cells are in a cellset. Only return number of cells in the cellset. FAST!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
MDX Query, as string |
required |
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
int
|
Number of Cells in the CellSet |
Source code in TM1py/Services/CellService.py
execute_mdx_csv(mdx, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, csv_dialect=None, line_separator='\r\n', value_separator=',', sandbox_name=None, include_attributes=False, use_iterative_json=False, use_compact_json=False, use_blob=False, mdx_headers=False, **kwargs)
Optimized for performance. Get csv string of coordinates and values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
Union[str, MdxBuilder]
|
Valid MDX Query |
required |
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
csv_dialect
|
Dialect
|
provide all csv output settings through standard library csv.Dialect If not provided dialect is created based on line_separator and value_separator arguments. |
None
|
line_separator
|
str
|
|
'\r\n'
|
value_separator
|
str
|
|
','
|
sandbox_name
|
str
|
str |
None
|
include_attributes
|
bool
|
include attribute columns |
False
|
use_iterative_json
|
bool
|
use iterative json parsing to reduce memory consumption significantly. Comes at a cost of 3-5% performance. |
False
|
use_compact_json
|
bool
|
bool |
False
|
use_blob
|
bool
|
Has better performance on datasets > 1M cells and lower memory footprint in any case. |
False
|
mdx_headers
|
bool
|
boolean, fully qualified hierarchy name as header instead of simple dimension name |
False
|
Returns:
| Type | Description |
|---|---|
str
|
String |
Source code in TM1py/Services/CellService.py
2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 | |
execute_mdx_dataframe(mdx, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, include_attributes=False, use_iterative_json=False, use_compact_json=False, use_blob=False, shaped=False, mdx_headers=False, fillna_numeric_attributes=False, fillna_numeric_attributes_value=0, fillna_string_attributes=False, fillna_string_attributes_value='', **kwargs)
Optimized for performance. Get Pandas DataFrame from MDX Query.
Takes all arguments from the pandas.read_csv method: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html
If 'use_blob' and 'shaped' are True, 'skip_zeros' will be overruled to False. This is necessary to assure column order is in line with cube view in TM1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
Union[str, MdxBuilder]
|
Valid MDX Query |
required |
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
include_attributes
|
bool
|
include attribute columns |
False
|
use_iterative_json
|
bool
|
use iterative json parsing to reduce memory consumption significantly. Comes at a cost of 3-5% performance. |
False
|
use_compact_json
|
bool
|
bool |
False
|
use_blob
|
bool
|
Has better performance on datasets > 1M cells and lower memory footprint in any case. |
False
|
shaped
|
bool
|
preserve shape of view/mdx in data frame |
False
|
mdx_headers
|
bool
|
boolean, fully qualified hierarchy name as header instead of simple dimension name |
False
|
fillna_numeric_attributes
|
bool
|
boolean, fills empty numerical attributes with fillna_numeric_attributes_value |
False
|
fillna_string_attributes
|
bool
|
boolean, fills empty string attributes with fillna_string_attributes_value |
False
|
fillna_numeric_attributes_value
|
Any
|
Any, value with which to replace na if fillna_numeric_attributes is True |
0
|
fillna_string_attributes_value
|
Any
|
Any, value with which to replace na if fillna_string_attributes is True |
''
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Pandas Dataframe |
Source code in TM1py/Services/CellService.py
2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 | |
execute_mdx_dataframe_async(mdx_list, max_workers=8, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, include_attributes=False, use_iterative_json=False, use_compact_json=False, use_blob=False, shaped=False, mdx_headers=False, **kwargs)
Source code in TM1py/Services/CellService.py
execute_mdx_dataframe_pivot(mdx, dropna=False, fill_value=None, sandbox_name=None)
Execute MDX Query to get a pandas pivot data frame in the shape as specified in the Query
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
|
required |
dropna
|
bool
|
|
False
|
fill_value
|
bool
|
|
None
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Source code in TM1py/Services/CellService.py
execute_mdx_dataframe_shaped(mdx, sandbox_name=None, display_attribute=False, use_iterative_json=False, use_blob=False, mdx_headers=False, **kwargs)
Retrieves data from cube in the shape of the query. Dimensions on rows can be stacked. One dimension must be placed on columns. Title selections are ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
|
required |
sandbox_name
|
str
|
str |
None
|
use_blob
|
bool
|
|
False
|
use_iterative_json
|
bool
|
|
False
|
display_attribute
|
bool
|
bool, show element name or first attribute from MDX PROPERTIES clause |
False
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Source code in TM1py/Services/CellService.py
execute_mdx_elements_value_dict(mdx, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, element_separator='|', sandbox_name=None, **kwargs)
Optimized for performance. Get Dict from MDX Query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
Valid MDX Query |
required |
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
element_separator
|
str
|
separator for the dimension element combination |
'|'
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveDict
|
CaseAndSpaceInsensitiveDict {'2020|Jan|Sales': 2000, '2020|Feb|Sales': 3000} |
Source code in TM1py/Services/CellService.py
execute_mdx_raw(mdx, cell_properties=None, elem_properties=None, member_properties=None, top=None, skip_contexts=False, skip=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, include_hierarchies=False, use_compact_json=False, **kwargs)
Execute MDX and return the raw data from TM1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
String, a valid MDX Query |
required |
cell_properties
|
Iterable[str]
|
List of properties to be queried from the cell. E.g. ['Value', 'RuleDerived', ...] |
None
|
elem_properties
|
Iterable[str]
|
List of properties to be queried from the elements. E.g. ['Name','Attributes', ...] |
None
|
member_properties
|
Iterable[str]
|
List of properties to be queried from the members. E.g. ['Name','Attributes', ...] |
None
|
top
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip_contexts
|
bool
|
skip elements from titles / contexts in response |
False
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
include_hierarchies
|
bool
|
retrieve Hierarchies property on Axes |
False
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
Dict
|
Raw format from TM1. |
Source code in TM1py/Services/CellService.py
execute_mdx_rows_and_values(mdx, element_unique_names=True, sandbox_name=None, **kwargs)
Execute MDX and retrieve row element names and values in a case and space insensitive dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
|
required |
element_unique_names
|
bool
|
|
True
|
sandbox_name
|
str
|
str |
None
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
|
Source code in TM1py/Services/CellService.py
execute_mdx_rows_and_values_string_set(mdx, exclude_empty_cells=True, sandbox_name=None, **kwargs)
Retrieve row element names and string cell values in a case and space insensitive set
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exclude_empty_cells
|
bool
|
|
True
|
mdx
|
str
|
|
required |
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveSet
|
|
Source code in TM1py/Services/CellService.py
execute_mdx_ui_array(mdx, elem_properties=None, member_properties=None, value_precision=2, top=None, skip=None, sandbox_name=None, use_compact_json=False, **kwargs)
Useful for grids or charting libraries that want an array of cell values per row. Returns 3-dimensional cell structure for tabbed grids or multiple charts. Rows and pages are dicts, addressable by their name. Proper order of rows can be obtained in headers[1] Example 'cells' return format:
'cells': {
'10100': {
'Net Operating Income': [ 19832724.72429739,
20365654.788303416,
20729201.329183243,
20480205.20121749],
'Revenue': [ 28981046.50724231,
29512482.207418434,
29913730.038971487,
29563345.9542385]},
'10200': {
'Net Operating Income': [ 9853293.623709997,
10277650.763958748,
10466934.096533755,
10333095.839474997],
'Revenue': [ 13888143.710000003,
14300216.43,
14502421.63,
14321501.940000001]}
},
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
mdx
|
str
|
a valid MDX Query |
required |
elem_properties
|
Iterable[str]
|
List of properties to be queried from the elements. E.g. ['UniqueName','Attributes'] |
None
|
member_properties
|
Iterable[str]
|
List of properties to be queried from the members. E.g. ['UniqueName','Attributes'] |
None
|
value_precision
|
int
|
Integer (optional) specifying number of decimal places to return |
2
|
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
|
dict : |
Source code in TM1py/Services/CellService.py
3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 | |
execute_mdx_ui_dygraph(mdx, elem_properties=None, member_properties=None, value_precision=2, top=None, skip=None, sandbox_name=None, use_compact_json=False, **kwargs)
Execute MDX get dygraph dictionary Useful for grids or charting libraries that want an array of cell values per column Returns 3-dimensional cell structure for tabbed grids or multiple charts Example 'cells' return format:
'cells': {
'10100': [
['Q1-2004', 28981046.50724231, 19832724.72429739],
['Q2-2004', 29512482.207418434, 20365654.788303416],
['Q3-2004', 29913730.038971487, 20729201.329183243],
['Q4-2004', 29563345.9542385, 20480205.20121749]],
'10200': [
['Q1-2004', 13888143.710000003, 9853293.623709997],
['Q2-2004', 14300216.43, 10277650.763958748],
['Q3-2004', 14502421.63, 10466934.096533755],
['Q4-2004', 14321501.940000001, 10333095.839474997]]
},
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
mdx
|
str
|
String, valid MDX Query |
required |
elem_properties
|
Iterable[str]
|
List of properties to be queried from the elements. E.g. ['UniqueName','Attributes'] |
None
|
member_properties
|
Iterable[str]
|
List of properties to be queried from the members. E.g. ['UniqueName','Attributes'] |
None
|
value_precision
|
int
|
Integer (optional) specifying number of decimal places to return |
2
|
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
Dict
|
dict: |
Source code in TM1py/Services/CellService.py
execute_mdx_values(mdx, sandbox_name=None, use_compact_json=False, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, **kwargs)
Optimized for performance. Query only raw cell values. Coordinates are omitted !
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
a valid MDX Query |
required |
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
skip_zeros
|
bool
|
bool |
False
|
skip_consolidated_cells
|
bool
|
bool |
False
|
skip_rule_derived_cells
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
List[Union[str, float]]
|
List of cell values |
Source code in TM1py/Services/CellService.py
execute_unbound_process(process, **kwargs)
Source code in TM1py/Services/CellService.py
execute_view(cube_name, view_name, private=False, cell_properties=None, top=None, skip_contexts=False, skip=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, element_unique_names=True, skip_cell_properties=False, use_compact_json=False, max_workers=1, async_axis=0, **kwargs)
get view content as dictionary with sweet and concise structure. Works on NativeView and MDXView !
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
cell_properties
|
Iterable[str]
|
List, cell properties: [Values, Status, HasPicklist, etc.] |
None
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_contexts
|
bool
|
skip elements from titles / contexts in response |
False
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
element_unique_names
|
bool
|
'[d1].[h1].[e1]' or 'e1' |
True
|
sandbox_name
|
str
|
str |
None
|
skip_cell_properties
|
bool
|
cell values in result dictionary, instead of cell_properties dictionary |
False
|
max_workers
|
int
|
Int, number of threads to use in parallel |
1
|
async_axis
|
int
|
0 (columns) or 1 (rows). On which axis to parallelize retrieval |
0
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
Dictionary : |
Source code in TM1py/Services/CellService.py
2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 | |
execute_view_async(cube_name, view_name, private=False, cell_properties=None, top=None, skip_contexts=False, skip=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, element_unique_names=True, skip_cell_properties=False, max_workers=8, async_axis=0, **kwargs)
get view content as dictionary with sweet and concise structure. Works on NativeView and MDXView !
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
cell_properties
|
Iterable[str]
|
List, cell properties: [Values, Status, HasPicklist, etc.] |
None
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_contexts
|
bool
|
skip elements from titles / contexts in response |
False
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
element_unique_names
|
bool
|
'[d1].[h1].[e1]' or 'e1' |
True
|
sandbox_name
|
str
|
str |
None
|
skip_cell_properties
|
bool
|
cell values in result dictionary, instead of cell_properties dictionary |
False
|
max_workers
|
int
|
Int, number of threads to use in parallel |
8
|
async_axis
|
int
|
0 (columns) or 1 (rows). On which axis to parallelize retrieval |
0
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
Dictionary : |
Source code in TM1py/Services/CellService.py
execute_view_cellcount(cube_name, view_name, private=False, sandbox_name=None, **kwargs)
Execute cube view in order to understand how many cells are in a cellset. Only return number of cells in the cellset. FAST!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
int
|
|
Source code in TM1py/Services/CellService.py
execute_view_csv(cube_name, view_name, private=False, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, csv_dialect=None, line_separator='\r\n', value_separator=',', sandbox_name=None, use_iterative_json=False, use_compact_json=False, use_blob=False, arranged_axes=None, mdx_headers=False, **kwargs)
Optimized for performance. Get csv string of coordinates and values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
csv_dialect
|
Dialect
|
provide all csv output settings through standard library csv.Dialect If not provided dialect is created based on line_separator and value_separator arguments. |
None
|
line_separator
|
str
|
|
'\r\n'
|
value_separator
|
str
|
|
','
|
sandbox_name
|
str
|
str |
None
|
use_iterative_json
|
bool
|
use iterative json parsing to reduce memory consumption significantly. Comes at a cost of 3-5% performance. |
False
|
use_compact_json
|
bool
|
bool |
False
|
use_blob
|
bool
|
Has 40% better performance and lower memory footprint in any case. Requires admin permissions. |
False
|
arranged_axes
|
Tuple[List, List, List]
|
Tuple of dimension names on all axes as 3 lists: Titles, Rows, Columns. Allows function to skip retrieval of cellset composition. E.g.: arranged_axes=(["Year"], ["Region","Product"], ["Period", "Version"]) |
None
|
mdx_headers
|
bool
|
boolean, fully qualified hierarchy name as header instead of simple dimension name |
False
|
Returns:
| Type | Description |
|---|---|
str
|
dict, String |
Source code in TM1py/Services/CellService.py
2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 | |
execute_view_dataframe(cube_name, view_name, private=False, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, use_iterative_json=False, use_blob=False, shaped=False, arranged_axes=None, mdx_headers=False, **kwargs)
Optimized for performance. Get Pandas DataFrame from an existing Cube View Context dimensions are omitted in the resulting Dataframe ! Cells with Zero/null are omitted !
If 'use_blob' and 'shaped' are True, 'skip_zeros' will be overruled to False. This is necessary to assure column order is in line with cube view in TM1
Takes all arguments from the pandas.read_csv method: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
use_iterative_json
|
bool
|
use iterative json parsing to reduce memory consumption significantly. Comes at a cost of 3-5% performance. |
False
|
use_blob
|
bool
|
Has 40% better performance and lower memory footprint in any case. Requires admin permissions. |
False
|
shaped
|
bool
|
Shape rows and columns of data frame as specified in cube view / MDX |
False
|
arranged_axes
|
Tuple[List, List, List]
|
Tuple of dimension names on all axes as 3 lists: Titles, Rows, Columns. Allows function to skip retrieval of cellset composition in use_blob mode. E.g.: axes=(["Year"], ["Region","Product"], ["Period", "Version"]) :param mdx_headers: boolean, fully qualified hierarchy name as header instead of simple dimension name |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Pandas Dataframe |
Source code in TM1py/Services/CellService.py
3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 | |
execute_view_dataframe_pivot(cube_name, view_name, private=False, dropna=False, fill_value=None, sandbox_name=None, **kwargs)
Execute a cube view to get a pandas pivot dataframe, in the shape of the cube view
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
dropna
|
bool
|
|
False
|
fill_value
|
bool
|
|
None
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Source code in TM1py/Services/CellService.py
execute_view_dataframe_shaped(cube_name, view_name, private=False, sandbox_name=None, use_iterative_json=False, use_blob=False, mdx_headers=False, **kwargs)
Retrieves data from cube in the shape of the query. Dimensions on rows can be stacked. One dimension must be placed on columns. Title selections are ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
|
required |
view_name
|
str
|
|
required |
private
|
bool
|
|
False
|
sandbox_name
|
str
|
str |
None
|
use_blob
|
bool
|
|
False
|
use_iterative_json
|
bool
|
|
False
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Source code in TM1py/Services/CellService.py
3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 | |
execute_view_elements_value_dict(cube_name, view_name, private=False, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, element_separator='|', sandbox_name=None, **kwargs)
Optimized for performance. Get a Dict(tuple, value) from an existing Cube View Context dimensions are omitted in the resulting Dataframe ! Cells with Zero/null are omitted by default, but still configurable!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
element_separator
|
str
|
separator for the dimension element combination |
'|'
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveDict
|
CaseAndSpaceInsensitiveDict {'2020|Jan|Sales': 2000, '2020|Feb|Sales': 3000} |
Source code in TM1py/Services/CellService.py
execute_view_raw(cube_name, view_name, private=False, cell_properties=None, elem_properties=None, member_properties=None, top=None, skip_contexts=False, skip=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, use_compact_json=False, **kwargs)
Execute a cube view and return the raw data from TM1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
cell_properties
|
Iterable[str]
|
List of properties to be queried from the cell. E.g. ['Value', 'RuleDerived', ...] |
None
|
elem_properties
|
Iterable[str]
|
List of properties to be queried from the elements. E.g. ['Name','Attributes', ...] |
None
|
member_properties
|
Iterable[str]
|
List of properties to be queried from the members. E.g. ['Name','Attributes', ...] |
None
|
top
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip_contexts
|
bool
|
skip elements from titles / contexts in response |
False
|
skip
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
Dict
|
Raw format from TM1. |
Source code in TM1py/Services/CellService.py
execute_view_rows_and_values(cube_name, view_name, private=False, element_unique_names=True, sandbox_name=None, **kwargs)
Execute cube view and retrieve row element names and values in a case and space insensitive dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
element_unique_names
|
bool
|
|
True
|
sandbox_name
|
str
|
str |
None
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
|
Source code in TM1py/Services/CellService.py
execute_view_rows_and_values_string_set(cube_name, view_name, private=False, exclude_empty_cells=True, sandbox_name=None, **kwargs)
Retrieve row element names and string cell values in a case and space insensitive set
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
exclude_empty_cells
|
bool
|
|
True
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveSet
|
|
Source code in TM1py/Services/CellService.py
execute_view_ui_array(cube_name, view_name, private=False, elem_properties=None, member_properties=None, value_precision=2, top=None, skip=None, sandbox_name=None, use_compact_json=False, **kwargs)
Useful for grids or charting libraries that want an array of cell values per row. Returns 3-dimensional cell structure for tabbed grids or multiple charts. Rows and pages are dicts, addressable by their name. Proper order of rows can be obtained in headers[1] Example 'cells' return format:
'cells': {
'10100': {
'Net Operating Income': [ 19832724.72429739,
20365654.788303416,
20729201.329183243,
20480205.20121749],
'Revenue': [ 28981046.50724231,
29512482.207418434,
29913730.038971487,
29563345.9542385]},
'10200': {
'Net Operating Income': [ 9853293.623709997,
10277650.763958748,
10466934.096533755,
10333095.839474997],
'Revenue': [ 13888143.710000003,
14300216.43,
14502421.63,
14321501.940000001]}
},
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
elem_properties
|
Iterable[str]
|
List of properties to be queried from the elements. E.g. ['UniqueName','Attributes'] |
None
|
member_properties
|
Iterable[str]
|
List properties to be queried from the member. E.g. ['Name', 'UniqueName'] |
None
|
value_precision
|
int
|
Integer (optional) specifying number of decimal places to return |
2
|
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
|
dict : |
Source code in TM1py/Services/CellService.py
3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 | |
execute_view_ui_dygraph(cube_name, view_name, private=False, elem_properties=None, member_properties=None, value_precision=2, top=None, skip=None, sandbox_name=None, use_compact_json=False, **kwargs)
Useful for grids or charting libraries that want an array of cell values per row. Returns 3-dimensional cell structure for tabbed grids or multiple charts. Rows and pages are dicts, addressable by their name. Proper order of rows can be obtained in headers[1] Example 'cells' return format: 'cells': { '10100': { 'Net Operating Income': [ 19832724.72429739, 20365654.788303416, 20729201.329183243, 20480205.20121749], 'Revenue': [ 28981046.50724231, 29512482.207418434, 29913730.038971487, 29563345.9542385]}, '10200': { 'Net Operating Income': [ 9853293.623709997, 10277650.763958748, 10466934.096533755, 10333095.839474997], 'Revenue': [ 13888143.710000003, 14300216.43, 14502421.63, 14321501.940000001]} },
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
cube_name
|
str
|
cube name |
required |
view_name
|
str
|
view name |
required |
private
|
bool
|
True (private) or False (public) |
False
|
elem_properties
|
Iterable[str]
|
List of properties to be queried from the elements. E.g. ['UniqueName','Attributes'] |
None
|
member_properties
|
Iterable[str]
|
List of properties to be queried from the members. E.g. ['UniqueName','Attributes'] |
None
|
value_precision
|
int
|
Integer (optional) specifying number of decimal places to return |
2
|
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
|
|
Source code in TM1py/Services/CellService.py
3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 | |
execute_view_values(cube_name, view_name, private=False, sandbox_name=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, use_compact_json=False, **kwargs)
Execute view and retrieve only the cell values
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
String, name of the cube |
required |
view_name
|
str
|
String, name of the view |
required |
private
|
bool
|
True (private) or False (public) |
False
|
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
skip_zeros
|
bool
|
bool |
False
|
skip_consolidated_cells
|
bool
|
bool |
False
|
skip_rule_derived_cells
|
bool
|
bool |
False
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
List[Union[str, float]]
|
|
Source code in TM1py/Services/CellService.py
extract_cellset(cellset_id, cell_properties=None, top=None, skip=None, delete_cellset=True, skip_contexts=False, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, element_unique_names=True, skip_cell_properties=False, use_compact_json=False, skip_sandbox_dimension=False, **kwargs)
Execute cellset and return the cells with their properties
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skip_contexts
|
bool
|
|
False
|
delete_cellset
|
bool
|
|
True
|
cellset_id
|
str
|
|
required |
cell_properties
|
Iterable[str]
|
properties to be queried from the cell. E.g. Value, Ordinal, RuleDerived, ... |
None
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
element_unique_names
|
bool
|
'[d1].[h1].[e1]' or 'e1' |
True
|
skip_cell_properties
|
bool
|
cell values in result dictionary, instead of cell_properties dictionary |
False
|
use_compact_json
|
bool
|
bool |
False
|
skip_sandbox_dimension
|
bool
|
skip sandbox dimension |
False
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
Content in sweet concise structure. |
Source code in TM1py/Services/CellService.py
4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 | |
extract_cellset_async(cellset_id, cell_properties=None, top=None, skip=None, delete_cellset=True, skip_contexts=False, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, element_unique_names=True, skip_cell_properties=False, skip_sandbox_dimension=False, max_workers=8, async_axis=1, **kwargs)
Execute cellset and return the cells with their properties
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skip_contexts
|
bool
|
|
False
|
delete_cellset
|
bool
|
|
True
|
cellset_id
|
str
|
|
required |
cell_properties
|
Iterable[str]
|
properties to be queried from the cell. E.g. Value, Ordinal, RuleDerived, ... |
None
|
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
element_unique_names
|
bool
|
'[d1].[h1].[e1]' or 'e1' |
True
|
skip_cell_properties
|
bool
|
cell values in result dictionary, instead of cell_properties dictionary |
False
|
skip_sandbox_dimension
|
bool
|
skip sandbox dimension |
False
|
max_workers
|
int
|
Int, number of threads to use in parallel |
8
|
async_axis
|
int
|
0 (columns) or 1 (rows). On which axis to parallelize retrieval |
1
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
Content in sweet concise structure. |
Source code in TM1py/Services/CellService.py
4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 | |
extract_cellset_axes_cardinality(cellset_id)
extract_cellset_axes_raw_async(cellset_id, async_axis=1, max_workers=8, elem_properties=None, member_properties=None, skip_contexts=False, include_hierarchies=False, sandbox_name=None, **kwargs)
Extract cellset axes asynchronously
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
String; ID of existing cellset |
required |
async_axis
|
int
|
determines which axis will be extracted asynchronously |
1
|
max_workers
|
int
|
Max number of threads, e.g. 14 |
8
|
elem_properties
|
Iterable[str]
|
List of properties to be queried from elements. E.g. ['UniqueName','Attributes', ...] |
None
|
member_properties
|
Iterable[str]
|
List properties to be queried from the member. E.g. ['Name', 'UniqueName'] |
None
|
skip_contexts
|
bool
|
skip elements from titles / contexts in response |
False
|
sandbox_name
|
str
|
str |
None
|
include_hierarchies
|
bool
|
retrieve Hierarchies property on Axes |
False
|
Returns:
| Type | Description |
|---|---|
|
Raw format from TM1. |
Source code in TM1py/Services/CellService.py
3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 | |
extract_cellset_cellcount(cellset_id, sandbox_name=None, **kwargs)
Retrieve number of cells in the cellset
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
|
required |
sandbox_name
|
str
|
str |
None
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
int
|
|
Source code in TM1py/Services/CellService.py
extract_cellset_cells_raw(cellset_id, cell_properties=None, top=None, skip=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, **kwargs)
Source code in TM1py/Services/CellService.py
extract_cellset_cells_raw_async(cellset_id, max_workers=8, cell_properties=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, **kwargs)
Source code in TM1py/Services/CellService.py
4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 | |
extract_cellset_composition(cellset_id, sandbox_name=None, **kwargs)
Retrieve composition of dimensions on the axes in the cellset
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
|
required |
kwargs
|
|
{}
|
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[str, List[str], List[str], List[str]]
|
|
Source code in TM1py/Services/CellService.py
extract_cellset_csv(cellset_id, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, csv_dialect=None, line_separator='\r\n', value_separator=',', sandbox_name=None, include_attributes=False, use_compact_json=False, include_headers=True, mdx_headers=False, **kwargs)
Execute cellset and return only the 'Content', in csv format
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
String; ID of existing cellset |
required |
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
csv_dialect
|
Dialect
|
provide all csv output settings through standard library csv.Dialect If not provided dialect is created based on line_separator and value_separator arguments. |
None
|
line_separator
|
str
|
|
'\r\n'
|
value_separator
|
str
|
|
','
|
sandbox_name
|
str
|
str |
None
|
include_attributes
|
bool
|
include attribute columns |
False
|
use_compact_json
|
bool
|
boolean |
False
|
include_headers
|
bool
|
boolean |
True
|
mdx_headers
|
bool
|
boolean. Fully qualified hierarchy name as header instead of simple dimension name |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Raw format from TM1. |
Source code in TM1py/Services/CellService.py
4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 | |
extract_cellset_csv_iter_json(cellset_id, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, csv_dialect=None, line_separator='\r\n', value_separator=',', sandbox_name=None, include_attributes=False, mdx_headers=False, **kwargs)
Execute cellset and return only the 'Content', in csv format
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
String; ID of existing cellset |
required |
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
csv_dialect
|
Dialect
|
provide all csv output settings through standard library csv.Dialect If not provided dialect is created based on line_separator and value_separator arguments. |
None
|
line_separator
|
str
|
|
'\r\n'
|
value_separator
|
str
|
|
','
|
sandbox_name
|
str
|
str |
None
|
include_attributes
|
bool
|
boolean |
False
|
mdx_headers
|
bool
|
boolean. Fully qualified hierarchy name as header instead of simple dimension name |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Raw format from TM1. |
Source code in TM1py/Services/CellService.py
4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 | |
extract_cellset_cube_with_dimensions(cellset_id, **kwargs)
Source code in TM1py/Services/CellService.py
extract_cellset_dataframe(cellset_id, top=None, skip=None, skip_zeros=True, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, include_attributes=False, use_iterative_json=False, use_compact_json=False, shaped=False, mdx_headers=False, fillna_numeric_attributes=False, fillna_numeric_attributes_value=0, fillna_string_attributes=False, fillna_string_attributes_value='', **kwargs)
Build pandas data frame from cellset_id
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
|
required |
top
|
int
|
Int, number of cells to return (counting from top) |
None
|
skip
|
int
|
Int, number of cells to skip (counting from top) |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
True
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
include_attributes
|
bool
|
include attribute columns |
False
|
use_iterative_json
|
bool
|
use iterative json parsing to reduce memory consumption significantly. Comes at a cost of 3-5% performance. |
False
|
use_compact_json
|
bool
|
bool |
False
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Source code in TM1py/Services/CellService.py
4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 | |
extract_cellset_dataframe_pivot(cellset_id, dropna=False, fill_value=False, sandbox_name=None, use_compact_json=False, **kwargs)
Extract a pivot table (pandas dataframe) from a cellset in TM1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
|
required |
dropna
|
bool
|
|
False
|
fill_value
|
bool
|
|
False
|
kwargs
|
|
{}
|
|
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Source code in TM1py/Services/CellService.py
extract_cellset_dataframe_shaped(cellset_id, sandbox_name=None, display_attribute=False, infer_dtype=False, mdx_headers=False, **kwargs)
Retrieves data from cellset in the shape of the query. Dimensions on rows can be stacked. One dimension must be placed on columns. Title selections are ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
cellset_id |
required |
sandbox_name
|
str
|
str |
None
|
display_attribute
|
bool
|
bool, show element name or first attribute from MDX PROPERTIES clause |
False
|
infer_dtype
|
bool
|
bool, if True, lets pandas infer dtypes, otherwise all columns will be of type str. |
False
|
Source code in TM1py/Services/CellService.py
4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 | |
extract_cellset_metadata_raw(cellset_id, elem_properties=None, member_properties=None, top=None, skip=None, skip_contexts=False, include_hierarchies=False, sandbox_name=None, delete_cellset=False, **kwargs)
Source code in TM1py/Services/CellService.py
extract_cellset_partition(cellset_id, partition_start_ordinal, partition_end_ordinal, cell_properties=None, top=None, skip=None, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None)
Method to extract a cellset partition. Cellset partitions are a collection of cellset cells where they have a defined top left boundary, and bottom right boundary. Read More: https://www.ibm.com/docs/en/planning-analytics/2.0.0?topic=data-cellsets#dg_tm1_odata_get_cells__title__1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
partition_start_ordinal
|
int
|
top left cell boundary |
required |
partition_end_ordinal
|
int
|
bottom right cell boundary |
required |
cell_properties
|
Iterable[str]
|
cell properties to include, default: Orginal, Value |
None
|
top
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
Dict
|
CellSet Dictionary |
Source code in TM1py/Services/CellService.py
3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 | |
extract_cellset_raw(cellset_id, cell_properties=None, elem_properties=None, member_properties=None, top=None, skip=None, skip_contexts=False, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, include_hierarchies=False, use_compact_json=False, **kwargs)
Extract full cellset data and return the raw data from TM1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
String; ID of existing cellset |
required |
cell_properties
|
Iterable[str]
|
List of properties to be queried from cells. E.g. ['Value', 'RuleDerived', ...] |
None
|
elem_properties
|
Iterable[str]
|
List of properties to be queried from elements. E.g. ['UniqueName','Attributes', ...] |
None
|
member_properties
|
Iterable[str]
|
List properties to be queried from the member. E.g. ['Name', 'UniqueName'] |
None
|
top
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip_contexts
|
bool
|
|
False
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
include_hierarchies
|
bool
|
retrieve Hierarchies property on Axes |
False
|
use_compact_json
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
Dict
|
Raw format from TM1. |
Source code in TM1py/Services/CellService.py
3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 | |
extract_cellset_raw_response(cellset_id, cell_properties=None, elem_properties=None, member_properties=None, top=None, skip=None, skip_contexts=False, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, sandbox_name=None, include_hierarchies=False, **kwargs)
Extract full cellset data and return the raw data from TM1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
String; ID of existing cellset |
required |
cell_properties
|
Iterable[str]
|
List of properties to be queried from cells. E.g. ['Value', 'RuleDerived', ...] |
None
|
elem_properties
|
Iterable[str]
|
List of properties to be queried from elements. E.g. ['UniqueName','Attributes', ...] |
None
|
member_properties
|
Iterable[str]
|
List properties to be queried from the member. E.g. ['Name', 'UniqueName'] |
None
|
top
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip
|
int
|
Integer limiting the number of cells and the number or rows returned |
None
|
skip_contexts
|
bool
|
|
False
|
skip_zeros
|
bool
|
skip zeros in cellset (irrespective of zero suppression in MDX / view) |
False
|
skip_consolidated_cells
|
bool
|
skip consolidated cells in cellset |
False
|
skip_rule_derived_cells
|
bool
|
skip rule derived cells in cellset |
False
|
sandbox_name
|
str
|
str |
None
|
include_hierarchies
|
bool
|
retrieve Hierarchies property on Axes |
False
|
Returns:
| Type | Description |
|---|---|
Response
|
Raw format from TM1. |
Source code in TM1py/Services/CellService.py
3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 | |
extract_cellset_rows_and_values(cellset_id, element_unique_names=True, sandbox_name=None, **kwargs)
Retrieve row element names and values in a case and space insensitive dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
|
required |
element_unique_names
|
bool
|
|
True
|
kwargs
|
|
{}
|
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
CaseAndSpaceInsensitiveTuplesDict
|
|
Source code in TM1py/Services/CellService.py
extract_cellset_values(cellset_id, sandbox_name=None, use_compact_json=False, skip_zeros=False, skip_consolidated_cells=False, skip_rule_derived_cells=False, **kwargs)
Extract cellset data and return only the cells and values
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
String; ID of existing cellset |
required |
sandbox_name
|
str
|
str |
None
|
use_compact_json
|
bool
|
bool |
False
|
skip_zeros
|
bool
|
bool |
False
|
skip_consolidated_cells
|
bool
|
bool |
False
|
skip_rule_derived_cells
|
bool
|
bool |
False
|
Returns:
| Type | Description |
|---|---|
List[Union[str, float]]
|
Raw format from TM1. |
Source code in TM1py/Services/CellService.py
generate_enable_sandbox_ti(sandbox_name)
Source code in TM1py/Services/CellService.py
get_cellset_cells_count(mdx)
Execute MDX in order to understand how many cells are in a cellset
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
MDX Query, as string |
required |
Returns:
| Type | Description |
|---|---|
int
|
Number of Cells in the CellSet |
Source code in TM1py/Services/CellService.py
get_cube_service()
get_dimension_names_for_writing(cube_name, **kwargs)
Get dimensions of a cube. Skip sandbox dimension
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
|
required |
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
List[str]
|
|
Source code in TM1py/Services/CellService.py
get_element_service()
get_elements_from_all_measure_hierarchies(cube_name)
Source code in TM1py/Services/CellService.py
get_error_log_file_content(file_name, **kwargs)
get_value(cube_name, elements=None, dimensions=None, sandbox_name=None, element_separator=',', hierarchy_separator='&&', hierarchy_element_separator='::', **kwargs)
Returns cube value from specified coordinates
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
Name of the cube |
required |
elements
|
Union[str, Iterable]
|
Describes the Dimension-Hierarchy-Element arrangement - Example: "Hierarchy1::Element1 && Hierarchy2::Element4, Element9, Element2" - Dimensions are not specified! They are derived from the position. - The , separates the element-selections - If more than one hierarchy is selected per dimension && splits the elementselections - If no Hierarchy is specified. Default Hierarchy will be addressed or Iterable of type mdxpy.Member or similar - Dimension names must be provided in this case! Example: [(Dimension1, Element1), (Dimension2, Element2), (Dimension3, Element3)] - Hierarchys can be included. Example: [(Dimension1, Hierarchy1, Element1), (Dimension1, Hierarchy2, Element2), (Dimension2, Element3)] |
None
|
dimensions
|
List[str]
|
List of dimension names in correct order |
None
|
sandbox_name
|
str
|
str |
None
|
element_separator
|
str
|
Alternative separator for the element selections |
','
|
hierarchy_separator
|
str
|
Alternative separator for multiple hierarchies |
'&&'
|
hierarchy_element_separator
|
str
|
Alternative separator between hierarchy name and element name |
'::'
|
Returns:
| Type | Description |
|---|---|
Union[str, float]
|
|
Source code in TM1py/Services/CellService.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
get_values(cube_name, element_sets=None, dimensions=None, sandbox_name=None, element_separator=',', hierarchy_separator='&&', hierarchy_element_separator='::', **kwargs)
Returns list of cube values from specified coordinates list. will be in same order as original list
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
Name of the cube |
required |
element_sets
|
Iterable[Iterable[str]]
|
Set of coordinates where each element is provided in the correct dimension order. [('2024', 'Actual', 'London', 'P02), ('2024', 'Forecast', 'Berlin', 'P03)] |
None
|
dimensions
|
List[str]
|
Dimension names in correct order |
None
|
sandbox_name
|
str
|
str |
None
|
element_separator
|
str
|
Alternative separator for the element selections |
','
|
hierarchy_separator
|
str
|
Alternative separator for multiple hierarchies |
'&&'
|
hierarchy_element_separator
|
str
|
Alternative separator between hierarchy name and element name |
'::'
|
Returns:
| Type | Description |
|---|---|
List
|
|
Source code in TM1py/Services/CellService.py
get_view_content(cube_name, view_name, cell_properties=None, private=False, top=None)
Source code in TM1py/Services/CellService.py
relative_proportional_spread(value, cube, unique_element_names, reference_unique_element_names, reference_cube=None, sandbox_name=None, **kwargs)
Execute relative proportional spread
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
value to be spread |
required |
cube
|
str
|
name of the cube |
required |
unique_element_names
|
Iterable[str]
|
target cell coordinates as unique element names (e.g. ["[d1].[c1]","[d2].[e3]"]) |
required |
reference_cube
|
str
|
name of the reference cube. Can be None |
None
|
reference_unique_element_names
|
Iterable[str]
|
reference cell coordinates as unique element names |
required |
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
Response
|
|
Source code in TM1py/Services/CellService.py
sandbox_exists(sandbox_name)
trace_cell_calculation(cube_name, elements, dimensions=None, sandbox_name=None, depth=1, element_separator=',', hierarchy_separator='&&', hierarchy_element_separator='::', **kwargs)
Trace cell calculation at specified coordinates
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
name of the target cube |
required |
elements
|
Union[Iterable, str]
|
string "Hierarchy1::Element1 && Hierarchy2::Element4, Element9, Element2" - Dimensions are not specified! They are derived from the position. - The , separates the element-selections - If more than one hierarchy is selected per dimension && splits the elementselections - If no Hierarchy is specified. Default Hierarchy will be addressed or Iterable [Element1, Element2, Element3] |
required |
dimensions
|
Iterable[str]
|
optional. Dimension names in their natural order. Will speed up the execution! |
None
|
sandbox_name
|
str
|
str |
None
|
depth
|
int
|
optional. Depth of the component trace that will be returned. Deeper traces take longer |
1
|
element_separator
|
str
|
Alternative separator for the elements, if elements are passed as string |
','
|
hierarchy_separator
|
str
|
Alternative separator for multiple hierarchies, if elements are passed as string |
'&&'
|
hierarchy_element_separator
|
str
|
Alternative separator between hierarchy name and element name, if elements are passed as string |
'::'
|
Returns:
| Type | Description |
|---|---|
Dict
|
trace json string |
Source code in TM1py/Services/CellService.py
trace_cell_feeders(cube_name, elements, dimensions=None, sandbox_name=None, element_separator=',', hierarchy_separator='&&', hierarchy_element_separator='::', **kwargs)
Trace feeders from a cell
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
name of the target cube |
required |
elements
|
Union[Iterable, str]
|
string "Hierarchy1::Element1 && Hierarchy2::Element4, Element9, Element2" - Dimensions are not specified! They are derived from the position. - The , separates the element-selections - If more than one hierarchy is selected per dimension && splits the elementselections - If no Hierarchy is specified. Default Hierarchy will be addressed or Iterable [Element1, Element2, Element3] |
required |
dimensions
|
Iterable[str]
|
optional. Dimension names in their natural order. Will speed up the execution! |
None
|
sandbox_name
|
str
|
str |
None
|
element_separator
|
str
|
Alternative separator for the elements, if elements are passed as string |
','
|
hierarchy_separator
|
str
|
Alternative separator for multiple hierarchies, if elements are passed as string |
'&&'
|
hierarchy_element_separator
|
str
|
Alternative separator between hierarchy name and element name, if elements are passed as string |
'::'
|
Returns:
| Type | Description |
|---|---|
Dict
|
feeder trace |
Source code in TM1py/Services/CellService.py
transaction_log_is_active(cube_name)
Source code in TM1py/Services/CellService.py
undo_changeset(changeset)
undo a changeset. Similar to rolling back transactions.
Returns:
| Type | Description |
|---|---|
Response
|
Change set ID |
Source code in TM1py/Services/CellService.py
update_cellset(cellset_id, values, sandbox_name=None, changeset=None, **kwargs)
Write values into cellset
Number of values must match the number of cells in the cellset
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cellset_id
|
str
|
|
required |
values
|
Iterable
|
iterable with Numeric and String values |
required |
sandbox_name
|
str
|
str |
None
|
changeset
|
str
|
|
None
|
Returns:
| Type | Description |
|---|---|
Response
|
|
Source code in TM1py/Services/CellService.py
write(cube_name, cellset_as_dict, dimensions=None, increment=False, deactivate_transaction_log=False, reactivate_transaction_log=False, sandbox_name=None, use_ti=False, use_blob=False, use_changeset=False, precision=None, skip_non_updateable=False, measure_dimension_elements=None, remove_blob=True, allow_spread=False, clear_view=None, **kwargs)
Write values to a cube
Same signature as write_values method, but faster since it uses write_values_through_cellset
behind the scenes.
Supports incrementing cell values through optional increment argument
Spreading through spreading shortcuts is not supported!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
name of the cube |
required |
cellset_as_dict
|
Dict
|
{(elem_a, elem_b, elem_c): 243, (elem_d, elem_e, elem_f) : 109} |
required |
dimensions
|
Iterable[str]
|
optional. Dimension names in their natural order. Will speed up the execution! |
None
|
increment
|
bool
|
increment or update cell values |
False
|
deactivate_transaction_log
|
bool
|
deactivate before writing |
False
|
reactivate_transaction_log
|
bool
|
reactivate after writing |
False
|
sandbox_name
|
str
|
str |
None
|
use_ti
|
bool
|
Use unbound process to write. Requires admin permissions. causes massive performance improvement. |
False
|
use_blob
|
bool
|
Uses blob to write. Requires admin permissions. 10x faster compared to use_ti |
False
|
use_changeset
|
bool
|
Enable ChangesetID: True or False |
False
|
precision
|
int
|
max precision when writhing through unbound process. Necessary when dealing with large numbers to avoid "number too long" TI syntax error. |
None
|
skip_non_updateable
|
bool
|
skip cells that are not updateable (e.g. rule derived or consolidated) |
False
|
measure_dimension_elements
|
Dict
|
dictionary of measure elements and their types to improve performance when |
None
|
remove_blob
|
bool
|
remove blob file after writing with use_blob=True |
True
|
allow_spread
|
bool
|
allow TI process in use_blob or use_ti to use CellPutProportionalSpread on C elements |
False
|
clear_view
|
str
|
name of cube view to clear before writing |
None
|
Returns:
| Type | Description |
|---|---|
Optional[str]
|
changeset or None |
Source code in TM1py/Services/CellService.py
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | |
write_async(cube_name, cells, slice_size=250000, max_workers=8, dimensions=None, increment=False, deactivate_transaction_log=False, reactivate_transaction_log=False, sandbox_name=None, precision=None, measure_dimension_elements=None, **kwargs)
Write asynchronously
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
|
required |
cells
|
Dict
|
|
required |
slice_size
|
int
|
|
250000
|
max_workers
|
int
|
|
8
|
dimensions
|
Iterable[str]
|
|
None
|
increment
|
bool
|
|
False
|
deactivate_transaction_log
|
bool
|
|
False
|
reactivate_transaction_log
|
bool
|
|
False
|
sandbox_name
|
str
|
|
None
|
precision
|
int
|
max precision when writhing through unbound process. Necessary to decrease when dealing with large numbers to avoid "number too long" TI syntax error. |
None
|
measure_dimension_elements
|
Dict
|
dictionary of measure elements and their types to improve performance when |
None
|
kwargs
|
|
{}
|
Returns:
| Type | Description |
|---|---|
Optional[str]
|
|
Source code in TM1py/Services/CellService.py
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 | |
write_dataframe(cube_name, data, dimensions=None, increment=False, deactivate_transaction_log=False, reactivate_transaction_log=False, sandbox_name=None, use_ti=False, use_blob=False, use_changeset=False, precision=None, skip_non_updateable=False, measure_dimension_elements=None, sum_numeric_duplicates=True, remove_blob=True, allow_spread=False, clear_view=None, static_dimension_elements=None, infer_column_order=False, **kwargs)
Function expects same shape as execute_mdx_dataframe returns.
Column order must match dimensions in the target cube with an additional column for the values.
Column names are not relevant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
|
required |
data
|
DataFrame
|
Pandas Data Frame |
required |
dimensions
|
Iterable[str]
|
|
None
|
increment
|
bool
|
|
False
|
deactivate_transaction_log
|
bool
|
|
False
|
reactivate_transaction_log
|
bool
|
|
False
|
sandbox_name
|
str
|
|
None
|
use_ti
|
bool
|
|
False
|
use_blob
|
bool
|
Uses blob to write. Requires admin permissions. 10x faster compared to use_ti |
False
|
use_changeset
|
bool
|
Enable ChangesetID: True or False |
False
|
precision
|
int
|
max precision when writhing through unbound process. Necessary when dealing with large numbers to avoid "number too long" TI syntax error |
None
|
skip_non_updateable
|
bool
|
skip cells that are not updateable (e.g. rule derived or consolidated) |
False
|
measure_dimension_elements
|
Dict
|
dictionary of measure elements and their types to improve performance when |
None
|
sum_numeric_duplicates
|
bool
|
Aggregate numerical values for duplicated intersections |
True
|
remove_blob
|
bool
|
remove blob file after writing with use_blob=True |
True
|
allow_spread
|
bool
|
allow TI process in use_blob or use_ti to use CellPutProportionalSpread on C elements |
False
|
clear_view
|
str
|
name of cube view to clear before writing |
None
|
static_dimension_elements
|
Dict
|
Dict of fixed dimension element pairs. Column is created for you. |
None
|
infer_column_order
|
bool
|
bool indicating whether the column order of the dataframe should automatically be inferred and mapped to the dimension order in the cube. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
changeset or None |
Source code in TM1py/Services/CellService.py
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | |
write_dataframe_async(cube_name, data, slice_size_of_dataframe=250000, max_workers=8, dimensions=None, increment=True, sandbox_name=None, deactivate_transaction_log=False, reactivate_transaction_log=False, **kwargs)
Write DataFrame into a cube using unbound TI processes in a multi-threading way. Requires admin permissions.
For a DataFrame with > 1,000,000 rows, this function will at least save half of runtime compared with write_dataframe function.
Column order must match dimensions in the target cube with an additional column for the values.
Column names are not relevant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
|
required |
data
|
DataFrame
|
Pandas Data Frame |
required |
slice_size_of_dataframe
|
int
|
Number of rows for each DataFrame slice, e.g. 10000 |
250000
|
max_workers
|
int
|
Max number of threads, e.g. 14 |
8
|
dimensions
|
Iterable[str]
|
|
None
|
increment
|
bool
|
increment or update cell values. Defaults to True. |
True
|
sandbox_name
|
str
|
name of the sandbox or None |
None
|
deactivate_transaction_log
|
bool
|
|
False
|
reactivate_transaction_log
|
bool
|
|
False
|
Returns:
| Type | Description |
|---|---|
|
the Future’s result or raise exception. |
Source code in TM1py/Services/CellService.py
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | |
write_through_blob(cube_name, cellset_as_dict, increment=False, sandbox_name=None, skip_non_updateable=False, remove_blob=True, dimensions=None, allow_spread=False, clear_view=None, **kwargs)
Writes data back to TM1 via an unbound TI process having an uploaded CSV as data source
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
str |
required |
cellset_as_dict
|
dict
|
|
required |
increment
|
bool
|
increment or update cell values |
False
|
sandbox_name
|
str
|
str |
None
|
skip_non_updateable
|
bool
|
skip cells that are not updateable (e.g. rule derived or consolidated) |
False
|
remove_blob
|
choose False to persist blob after write. Can be helpful for troubleshooting. |
True
|
|
dimensions
|
str
|
optional. Dimension names in their natural order. Will speed up the execution! |
None
|
allow_spread
|
bool
|
allow TI process in use_blob or use_ti to use CellPutProportionalSpread on C elements. |
False
|
clear_view
|
str
|
name of cube view to clear before writing |
None
|
kwargs
|
Additional arguments for the REST request |
{}
|
Returns:
| Type | Description |
|---|---|
|
Success: bool, Messages: list, ChangeSet: None |
Source code in TM1py/Services/CellService.py
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 | |
write_through_cellset(cube_name, cellset_as_dict, dimensions=None, increment=False, deactivate_transaction_log=False, reactivate_transaction_log=False, sandbox_name=None, use_changeset=False, skip_non_updateable=False, **kwargs)
Source code in TM1py/Services/CellService.py
write_through_unbound_process(cube_name, cellset_as_dict, increment=False, sandbox_name=None, precision=None, skip_non_updateable=False, measure_dimension_elements=None, is_attribute_cube=None, dimensions=None, allow_spread=False, **kwargs)
Writes data back to TM1 via an unbound TI process
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
str |
required |
cellset_as_dict
|
Dict
|
cellset_as_dict |
required |
increment
|
bool
|
increment or update cell values |
False
|
sandbox_name
|
str
|
str |
None
|
precision
|
int
|
max precision when writhing through unbound process. |
None
|
skip_non_updateable
|
bool
|
skip cells that are not updateable (e.g. rule derived or consolidated) |
False
|
measure_dimension_elements
|
Dict
|
pass dictionary of measure elements and their types to improve performance. When all written values are numeric you can pass a defaultdict with default key: 'Numeric' |
None
|
is_attribute_cube
|
bool
|
bool or None |
None
|
allow_spread
|
bool
|
allow TI process in use_blob or use_ti to use CellPutProportionalSpread on C elements |
False
|
kwargs
|
Additional arguments for the REST request. |
{}
|
Returns:
| Type | Description |
|---|---|
|
Success: bool, Messages: list, ChangeSet: None |
Source code in TM1py/Services/CellService.py
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 | |
write_value(value, cube_name, element_tuple, dimensions=None, sandbox_name=None, **kwargs)
Write value into cube at specified coordinates
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Union[str, float]
|
the actual value |
required |
cube_name
|
str
|
name of the target cube |
required |
element_tuple
|
Iterable
|
target coordinates |
required |
dimensions
|
Iterable[str]
|
optional. Dimension names in their natural order. Will speed up the execution! |
None
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
Response
|
response |
Source code in TM1py/Services/CellService.py
write_values(cube_name, cellset_as_dict, dimensions=None, sandbox_name=None, changeset=None, **kwargs)
Write values to a cube
For cellsets with > 1000 cells look into write or write_values_through_cellset
Supports spreading shortcuts
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_name
|
str
|
name of the cube |
required |
cellset_as_dict
|
Dict
|
{(elem_a, elem_b, elem_c): 243, (elem_d, elem_e, elem_f) : 109} |
required |
dimensions
|
Iterable[str]
|
optional. Dimension names in their natural order. Will speed up the execution! |
None
|
sandbox_name
|
str
|
str |
None
|
changeset
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Response |
Source code in TM1py/Services/CellService.py
write_values_through_cellset(mdx, values, increment=False, sandbox_name=None, **kwargs)
Significantly faster than write_values function
Cellset gets created according to MDX Expression. For instance: [[61, 29 ,13], [42, 54, 15], [17, 28, 81]]
Each value in the cellset can be addressed through its position: The ordinal integer value. Ordinal-enumeration goes from top to bottom from left to right Number 61 has Ordinal 0, 29 has Ordinal 1, etc.
The order of the iterable determines the insertion point in the cellset. For instance: [91, 85, 72, 68, 51, 42, 35, 28, 11]
would lead to: [[91, 85 ,72], [68, 51, 42], [35, 28, 11]]
When writing large datasets into TM1 Cubes it can be convenient to call this function asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdx
|
str
|
Valid MDX Expression. |
required |
values
|
Iterable
|
List of values. The Order of the List/ Iterable determines the insertion point in the cellset. |
required |
increment
|
bool
|
increment or update cells |
False
|
sandbox_name
|
str
|
str |
None
|
Returns:
| Type | Description |
|---|---|
str
|
changeset: str |
Source code in TM1py/Services/CellService.py
manage_changeset(func)
Control the start and end of change sets which goups write events together in the TM1 transaction log.
Decorated function working with all non-TI based writing methods
Source code in TM1py/Services/CellService.py
manage_transaction_log(func)
Control state of transaction log during and after write operation for a given cube through:
deactivate_transaction_log and reactivate_transaction_log.
Decorated function must have either cube_name or mdx as first argument or keyword argument
Source code in TM1py/Services/CellService.py
odata_compact_json(return_as_dict)
Higher order function to manage header and response when using compact JSON
Applies when decorated function has use_compact_json argument set to True
Currently only supports responses with only cell properties and where they are explicitly specified: * Cellsets('...')?$expand=Axes(...),Cells($select=Ordinal,Value...) does NOT work ! * Cellsets('...')?$expand=Cells does NOT work ! * Cellsets('...')?$expand=Cells($select=Ordinal,Value...) works !
Source code in TM1py/Services/CellService.py
tidy_cellset(func)
Higher order function to tidy up cellset after usage