cubewise-code / tm1py

TM1py is a Python package that wraps the TM1 REST API in a simple to use library.
http://tm1py.readthedocs.io/en/latest/
MIT License
189 stars 109 forks source link

initialize_transaction_log_delta_requests / execute_transaction_log_delta_request does not support filters #1031

Closed mmmente closed 9 months ago

mmmente commented 9 months ago

Describe the bug The filter argument on initialize_transaction_log_delta_requests() does not work and execute_transaction_log_delta_request() reports transactions outside of the filter.

To Reproduce

import configparser
import time

from TM1py import TM1Service

config = configparser.ConfigParser()
config.read(r'..\config.ini')

cube_name = "Retail"

# Establish connection to TM1 Source
with TM1Service(**config['tm1srv01']) as tm1:
    # Start Change Tracking
    tm1.server.initialize_transaction_log_delta_requests("Cube eq '" + cube_name + "'")

    # Continuous checks
    def job():
        entries = tm1.server.execute_transaction_log_delta_request()
        if len(entries) > 0:
            for entry in entries:
                print(entry["Cube"])

    while True:
        job()
        time.sleep(1)
  1. Run the script
  2. Make a change / annotation in a cube that is not Retail and see a log entry printed. [e['Cube'] for e in entries] shows which cube was changed

Expected behavior I assume that the REST API actually does not support the filter argument. I could not find any documentation around that.

Version TM1py 1.11.3 TM1 Server Version: 11.8.02200.2

MariusWirtz commented 9 months ago

This is correct.

Earlier versions of the TM1 REST API would support delta requests on cube level but it is no longer supported. Delta requests will be dropped entirely with TM1 v12.

My personal opinion on delta requests on the transaction log is that it's best to avoid them if you can. It's fragile, and it might easily break if an overnight data load writes excessive entries to the transaction log.

I have seen it working in production well when rigorous transaction log management is implemented, and all entries in the transaction log are human inputs.