-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Hello,
since I'm posting a lot you can expect me to become Diametric master and Diametric well documented library with nice FAQ ;)
I've been struggling with passing more than one argument to Diametric::Persistence::Peer.q method.
Let's say I have a following code:
qString = "
[:find ?e
:in $ [?badge_name ...]
:where
[?e :badge/name ?badge_name]
]
"
It's crucial here that I use collection [?t ...] (I need to create simple OR statetent and retrieve all he Badges that has a name that exist in the set specified by me).
I'm calling it through, eg.
result = Diametric::Persistence::Peer.q(qString, @conn.db, ['facebook_is_fan', 'facebook_engagement_gold', 'average_weekly_revenue'])
Works as expected. However, if I add additional source argument into my query string:
qString = "
[:find ?e
:in $ ?badge_value [?badge_name ...]
:where
[?e :badge/value ?badge_value]
[?e :badge/name ?badge_name]
]
"
I cannot come up with a way of adding additional parameter as source argument.
For instance,
result = Diametric::Persistence::Peer.q(qString, @conn.db, [[30.42], ['facebook_is_fan', 'facebook_engagement_gold', 'average_weekly_revenue']])
Returns
RuntimeError: Datomic Exception: :db.error/too-few-inputs Query expected 3 inputs but received 2
q at diametric/DiametricPeer.java:295
Isn't it caused by implementation of q() method that contains the call for Diametric::Persistence::Peer.q(query, db, args.flatten(1)) and the call for Clojure APi should not expect only flattened list of source aguments?
I'd like to achieve sth like the suggested response for this issue https://groups.google.com/forum/?hl=pl#!topic/datomic/QZJrpbp-t-8
Thanks in advanve!