SQL in Atelier
Hello!
I'm trying to run a simple SQL query in atelier but it complains about the manager. I'm not sure if this is the best way to do it but here is what I got so far:
ZNSPACE "User"
SET domId = 1
SET flister=##class(%iKnow.Source.SQL.Lister).%New(domId)
SET myloader=##class(%iKnow.Source.Loader).%New(domId)
SET myquery="select top(10) EntityValue, CorpusFrequencyAsRelation, CorpusSpreadAsRelation from %iKnow_Objects.EntityUnique WHERE DomainId = 1 ORDER BY CorpusFrequencyAsRelation desc"
SET idfld="EntityValue"
SET grpfld="CorpusSpreadAsRelation"
SET dataflds=$LB("CorpusSpreadAsRelation")
SET stat=flister.AddListToBatch(myquery, idfld, grpfld, dataflds)
IF stat '= 1 {WRITE "The lister failed: ",$System.Status.DisplayError(stat) QUIT }
SET stat=myloader.ProcessBatch()
IF stat '= 1 {WRITE "The loader failed: ",$System.Status.DisplayError(stat) QUIT }
And the error I get:
ERROR #8230: Domain 1 is managed by User.SamtalSV and cannot be updated directly.1
How can I fix this? I don't need to change the table, I just need reading privileges
My second question: is this the easiest way of doing it? All I need is to print the table, maybe something like this is possible:
zwrite query("SELECT * FROM ...")
Thanks for all the great feedback so far!