query update for lists?

Discussions, advice, bug reports and much more about the "dada" environment.
Post Reply
Electrumpet
Posts: 27
Joined: Fri Jul 10, 2015 4:34 pm

query update for lists?

Post by Electrumpet » Sun Jan 15, 2023 6:54 am

Hi,

Is it possible to update a whole list in dada.base? I have searched online for SQlite solutions but I could not find any. More over it seems that this is not recommended.

Use case: A generated score (in my case a list of numbers) where a decision has to be made half way through for continuation and thus extra data in the list.

Thanks!

Best, Hans.

danieleghisi
Site Admin
Posts: 1349
Joined: Fri Dec 03, 2010 1:25 pm

Re: query update for lists?

Post by danieleghisi » Sun Jan 15, 2023 1:15 pm

Hi, indeed, SQLite is not very happy with lists in general.
However, if you have the latest dada release (0.3), there's a new attribute @llllastext which you can turn on in order to store lllls in text form, and which allows you to do UPDATE queries. It's not well documented, so I'm adding this as a new tab in the help file. Have a look:

<pre><code>
----------begin_max5_patcher----------
845.3oc6X00aZCCE84vuBq7RklXH67EgIUoMswzdXSapsS6ADB4j3Fbavgk3
v.U0+6yej.gkPGBpXqRfDIwWeiu9b7w9ZmG5XXFjtjjaBdCXDvv3gNFFJSRC
FkkMLmgWFlfyUtYxH+JM3Nyt5p3jkbk4.b3zdyynLdUUrhYoE7DBW8dvRqzH
k6hl30H2JWmi4gSor3IYjPttyfrs5A6BrG3Ju44IuZILAFuo4orpVGUZLGuf
DMQz3h1YBlyynAEbM9LViGCyEjrbZJSzDAjLYk9PKHTU4ic5Tc8wNc2SNYFI
OGGSZPJ+rfjsBb8vOO782.dE3iW80u.lshiCRHsyRnVXIXkqZ+3qlSzTjo4Z
xnEBzxRwb1Hj7FRyi6lAsdFgMNJhv3BjWhUvHwX.GfFCFMaUBU7HFD.BAQ.x
38lGbNLZ.0WCbTe0MG+SGMnG8+929v6tY3Zp35g2.JIgKAWbKHFLEPA2cA3G
eZ3UCAJh5R.buokAGn5.pIBWsHwy+et5.dTpi9Gn5vsud1A7jqNDzfF9aSCz
MzPx9CezABejZ3G4.0rf2yO72Q5hHbDtW.Nm.dah3GNWVC.0NfsZBX6cC3tx
jQr3mF3kYWb8z329ujd4..tDPhjO7TVUWcpL4nrpJCKvYL7LUG2rvy0ABQPj
+HmwMnK21IF6Rq2lx32hCI6Pc3uIOalHdbR1DBSkDpVh4f3vzjzrR9QxGvd8
88srckO4zG5562UVwZJpUpW9WgyJuRHw3vURjrt8q5hh8LbebVZAKpt0sbcj
H11NCfVca4g5cFZLKUL9lPCuudi0xXui0.chQG0fNr55SuyBU2jn5ndBmOoB
B6lBBmiRPf7NqHpoHb8sqkL7kfhvpohv93TDNmUDMWinZWiu.TDnlJBqiSQX
eVQTWQ.2Zmh++qHZHGPGmbv5rbnlbvVuxP4NmOd4f58LSnr+7iwnhsz91Zj7
zhrvJJq7D.fMQORbTBJCyoBYyFer09zpJbuiC7DEH68HNxufzQGHmSDf5ehh
yfCJNZAHd97xuMlJHxPHVN5N8zH+tphTltnqpXFYAsxe04zLwYhIKbwLkhL8
ZRK8zatvbVZDIiUPKORk.bhPpVpSt9U97xUeTqH14wN+FfdDMWI
-----------end_max5_patcher-----------
</code></pre>

Electrumpet
Posts: 27
Joined: Fri Jul 10, 2015 4:34 pm

Re: query update for lists?

Post by Electrumpet » Sun Jan 15, 2023 4:08 pm

Yes, great, this is exactly what I needed. Thanks for the quick respons and solution.

I could never have guessed that this could be an attribute for the database itself instead of an alteration of the method. I had to look a few times now as well before I saw it. Are there any repercussions to setting this attribute?

Best, Hans.

danieleghisi
Site Admin
Posts: 1349
Joined: Fri Dec 03, 2010 1:25 pm

Re: query update for lists?

Post by danieleghisi » Sun Jan 15, 2023 4:39 pm

I do not remember precisely, but I expect the acces to be somewhat slower (parsing and deparsing)...

In any case, it is better documented for any future release.

Thanks,
d

Electrumpet
Posts: 27
Joined: Fri Jul 10, 2015 4:34 pm

Re: query update for lists?

Post by Electrumpet » Mon Jan 16, 2023 1:01 am

Hi,

I think I found one issue. When I use 'llllastext' and I set that field as (one of) the contentfield(s) for cartesian, the content that comes back is "1" instead of the whole list of numbers. When changing llllastext back to 0 it works as supposed while this does not change anything in the content of the database itself....

This behaviour is only when I change the attribute in the dada object itself. When changing the attribute with a message the behaviour is gone. So it seems it has something to do with what happens during the initiation of the dada object.

Best, Hans.

danieleghisi
Site Admin
Posts: 1349
Joined: Fri Dec 03, 2010 1:25 pm

Re: query update for lists?

Post by danieleghisi » Mon Jan 16, 2023 1:03 pm

Hi Hans, could you provide a minimal patch showing the issue?
thanks,
d

Electrumpet
Posts: 27
Joined: Fri Jul 10, 2015 4:34 pm

Re: query update for lists?

Post by Electrumpet » Tue Jan 17, 2023 12:23 am

As minimal as I could make it.

As it is in my case I now see large integers where I saw 1's in yesterday's case. Changing the llllastext attribute to 0 will offer the lists as it is supposed to. If you do, you can still toggle the llllastext attribute and then I don't have problems (although I'll have to refresh the database content. Yesterday I worked with two instances of the dada object and it was a little different)...

Max 8.5.2
MacOs 12.6
Intel Mac 8-core from 2019

Best, Hans.

<pre><code>
----------begin_max5_patcher----------
1131.3ocyX00iiZCE84jeEVn8oprQ1lu6SUp61mZUkZm2FMZjA7lgsfIELyl
zU6+8ZecHC6FHfXXXFhDDrM93yky856kutdkUTwAdkE5mQ2hVs5qqWsBZR2v
pS2uxJmcHNiUACyJmWUw1ws1X5SxOHg14krpysll.sUD84262zVQsLiKkG2y
MvYYgt6TW6Yx3GRE6tujGKM856XuEuAY66CWB0mozs3yOinNOUnlPXUQepQC
LPqDciea8Z8oMijdB9WTq5KXWVAKIhI10AAo8yP3ItFKcoAZh46oO6FbcRRd
oIoDE07qKd5dcdtYfqW0NDR256tAQbc01.O5TrDtSvRzmZNScvpz2hdGoKig
yzj0ddAsj0dAKkrVVraWVWtmTp04UaIKmK4k2yErnLfN39HYpPNJd5XXnSy4
WZkceuOiKDRtP9oTdVBJKsR1ko.Os2oMjzGhXED7JGpJhE+v18k52PWxQRfU
+DgFZu0q8QfmRiZCzxiLEWxF8SE6Qdx8pEfBq6YRYYZTszruypyrak0i7xpz
BgZNh3k5NCvTLF5DrMyqEhumKRPrjDkvn7Hx3xeiZPefmWzksych97THnlM1
nLH1uIDHr3+AbDPGPG6hr1OKxRCv5KDL95j0tax9lT1TKzFstrUTqqEmbyHB
W5Gr0UGgD7xb7mhuFcNSDHCk0EQI8KJ1LRgAAHmOE36BPw91Q.qBNgvJfPD8
+Hnt1lO7Y4DPBA0en6R4v2GWOZ12qK+buowPZneq87b7dsY3ACCOzACmXTap
i6aJFp1mRpSK6G1mBc6AT5cnaOBmg.5Y20gUXh4q5aiaojoD7q7dWIrD11HU
klHEpo4042.1jeoU95clt9UiaMX4Im7mcLwtFbG74K3EP2XVoZSuTlngDWre
mMVcbpSUltOxODWjGolIyxmzZg1NZ9446+JJxgJnbbnaI9dA9Xem.ZXP.08p
A72zkATMTyqPw4U7H.HuH46J43KOvKavRTmk8z7a70Mt8VWx5Tg4ovsX8+Vy
KOBOwe+we+i+5MneB8a+0e9G8jymro7Gqt6OgoFg9qc.9qszgMC33SqvisVg
mq.4Dsf5PtZLHS5S1Fcm8o6v3gDdwJfLJiaQuGu0ILPWbcy+Z+rszmNSPepy
IqNsqLE7lTYkiwZPLoGQbwiyKTuFO4Lc501rEjpe56+BPeyGAiDPlF8ksUn8
ycX1TRSwO9YAgkjt8u2fTUTWF2PflxjPOsnR3UxTASpBX0ZPTyX5zlOVfbVH
bnKEP9KDNdi.GxLfi6BgS3XvYN.BlDxPHQmKjFjS1yARzwhDYNPhLFjnOWjr
GCmbmCq2R4KQ7WJfFyKof4HrJdgXDcLJ7lf7OOjFUD74P2ASh8.HENW.4L.P
NyEPzgrc34Bogj3dyEPCIGtTMXx.ise+o57.TzXnR97yElOv4F31Tg4VnFJq
R9ioMiGJD2hUpRhTpxfr1TJk0AOy2A.p1pTnxc0j8mhcJHgDaEpzUq1yLDAx
+c82V++PNIjuo
-----------end_max5_patcher-----------
</code></pre>

danieleghisi
Site Admin
Posts: 1349
Joined: Fri Dec 03, 2010 1:25 pm

Re: query update for lists?

Post by danieleghisi » Tue Jan 17, 2023 4:50 pm

You are right. This is a bug in dada.cartesian (and also dada.distances, by the way).
I'm fixing this for the whatever Patreon dev-release comes next. Sorry.

Electrumpet
Posts: 27
Joined: Fri Jul 10, 2015 4:34 pm

Re: query update for lists?

Post by Electrumpet » Tue Jan 17, 2023 10:53 pm

No problem. I am always happy when I find a bug instead of doing something stupid myself which is more often the case :D .

One more question. To display a subset in dada.cartesian I do a query and copy that data into another database and make that the source of dada.cartesian, right? There is no method to only display part of the original database in dada.cartesian I guess?

Best, Hans.

danieleghisi
Site Admin
Posts: 1349
Joined: Fri Dec 03, 2010 1:25 pm

Re: query update for lists?

Post by danieleghisi » Wed Jan 18, 2023 8:58 am

Yes there is – you just need to set the @where attribute. E.g.
@where "centroid > 3000"
or something like that.

Post Reply