Hi @drsk , thanks a lot for your guidance!
I have been going through DAML docs, especially Ledger API part, and I have some following questions that I would really appreciate your help!
As I understood, HTTP JSON API can only be used to fetch contracts that are active. While in my use case, I need to be able to keep all transactions so I can keep track of everything and query afterwards. For example, if a batch of raw material is used to produce product_A and product_B, while some time later, when all transactions are finished and all contracts are archived, I got informed by the customer who is using product_B that product_B has some defects, and I would need to trace back and find which batch of raw material was used, so eventually I can further notify the other customers, in this case, it’s the customer who is using product_A. Since in this case, all transactions are already finished and no contract is active, how should I keep track of all historical transactions? And by “join”, I mean, take the above for instance, I can find the batch numbers of raw material with defects, so I can join this information with a “table” that is like <batch_number, product_number, customer_number>, and so I can find out the customers that are being affected.
I find there is a developing function “extractor” which can be used to “dump” contracts and transactions to a PostgreSQL database. Is this the right way to go? If so, then we would need to run this extractor job every certain amount of time, is my assumption correct here?
In summary, my two questions are:
- How can I fetch/query historical transactions that are no longer active?
- To achieve the “join” goal, is there a nice way of doing in DAML? I can only think of dumping all transactions into a relational database and run sql queries against that.
3*. I’m thinking of the dependency tree data model that you suggested, do you have any sample code that I can refer to?
Thanks a lot for helping!
/Guisong