MD5 hash in BODS

Can anybody tell me how I can calculate a MD5 hash over a table in BODS?
And I want to make a custom function of it.

Thank you very much for helping me!


peilert :netherlands: (BOB member since 2006-04-12)

Hi peilert!
As far as I konow BODS does not have built-in function to calculate MD5 of the table. One of the solutions I’ve used in the past is to create stored proc in Database (HANA in my case) and execute this proc from BODS via sql() function.

In general - create cursor and loop over all rows in the table with HASH_MD5() function while concatenating your processed row with previous row hash. Though usage of cursors in HANA is not recommend by experts, it working quite fast and stable for me (HANA 1.0 SP12, my tables are relatively small - up to 10 millions rows / 20 column max.).
If you want to calculate hash of the data during load you can use User_Defined transform with md5 python module.

BR
qsi


qsi (BOB member since 2019-01-10)

Use the built in python editor in BODS to create an MD5 Hashing.

You can read more about BODS and Python support her:
https://help.sap.com/viewer/e54136ab6a4a43e6a370265bf0a2d744/4.2.9/en-US/576ae1ff6d6d1014b3fc9283b0e91070.html

Python md5 hashing code example:



import hashlib
hash_object = hashlib.md5(b'Hello World')
hex_dig = hash_object.hexdigest().upper()
print(hex_dig)

You can test the Python below:
https://repl.it/languages/python

Maybe anyone can help me with my question below regarding Data Vault and BODS + other ways of doing hashing in BODS other then Python.
https://bobj-board.org/t/249967


retro (BOB member since 2014-02-28)