Right - at this point I'd say set Server to apisidra.ibge.gov.br instead of api.sidra.ibge.gov.br and see if that fixes it.
- Log in to post comments
Right - at this point I'd say set Server to apisidra.ibge.gov.br instead of api.sidra.ibge.gov.br and see if that fixes it.
It looks like there might be an issue with the service you're trying to use - at https://apisidra.ibge.gov.br/ , pasting in "/t/1612/n2/all/v/all/p/last/c81/2702/f/u" as "Parâmetros/valores da API:" then clicking "Consultar" I get an alert saying "A solicitação de conexão com pools sofreu timeout".
I also see this from ObjectScript with Server set to apisidra.ibge.gov.br instead of api.sidra.ibge.gov.br
I'd recommend looking at what (other than valid JSON) is in result.HttpResponse.Data. Also worth looking at result.HttpResponse.StatusCode - is it 400 or 404?
Yeah... kind of annoying.
This is awesome!!
Clarifying question - re: "special tables that only support row-based sampling", would this be tables with custom/non-default storage definitions?
Thanks - simple example is:
do ##class(%SQL.Statement).%ExecDirect(,"select top 10 'foo'").%DisplayFormatted("CSV",,,.filesUsed)
do ##class(%Stream.FileCharacter).%OpenId(filesUsed(1)).OutputToDevice()@Steve Pisani I like the idea of this being configurable. You might want to chime in at https://github.com/intersystems/git-source-control/discussions/78 with your view on how this should work.
Note, this also assumes default global names - if you have customized these, you'll want to just get all globals. Also, replace 'C:\InterSystems\IRIS20\mgr\user' with the appropriate database directory for your instance.
Here's a full example relating global size back to related classes/tables, expanding on @Vitaliy Serdtsev's example:
select sdef.parent "Class", class.SqlSchemaName||'.'||class.SqlTableName "Table", LIST(sdef.Location) "Globals", SUM(s."Allocated MB") "Allocated MB", SUM(s."Used MB") "Used MB" from %SYS.GlobalQuery_Size('C:\InterSystems\IRIS20\mgr\user','','*D,*S,*I',0,0,1) s
join (
select parent,DataLocation as Location from %Dictionary.StorageDefinition where not parent %STARTSWITH '%'
union all
select parent,StreamLocation from %Dictionary.StorageDefinition where not parent %STARTSWITH '%'
union all
select parent,IndexLocation from %Dictionary.StorageDefinition where not parent %STARTSWITH '%'
) sdef
on sdef.Location = '^'||s.Name
join %Dictionary.CompiledClass class on class.Name = sdef.parent
group by sdef.parentNote that if you use inheritance with persistent classes sharing an extent this'll be a little bit off (since the same global is used for multiple classes and will be double counted).
By size, do you mean number of rows or size on disk?
I feel like a broken record, but InterSystems Support is pretty awesome and probably a better place to start for deeper HealthShare issues than the Developer Community. (And at first glance this seems like a deeper HealthShare issue.) Though it would be great if you could circle back and say what the solution was once you have one in case someone else runs into this!
Clarifying: I really enjoy the coding challenges and would highly recommend them, but competing for a top spot is a level of intensity beyond what I'd do. (Even if I wasn't an InterSystems employee and was eligible for prizes other than clout.
)
Just installed Docker on my machine for the first time (had just used it for GitHub Actions/Travis CI before). I feel a little bit like an old dog trying to learn new tricks... AOC 2021 is a good excuse for it!
Based on past years (participating as I have time between my day job and family obligations... so typically dropping off around the 15th), the ObjectScript leaderboard tends to be pretty competitive. Especially in terms of when the challenges drop - I'm not staying up until midnight or whatever it is to be in the top few.
Generally, Docker is better on a Mac than Windows, from what I hear.
Agreed all around!
@Peter (Sechaba) Tomodi I'd recommend reaching out to InterSystems Support on this.
@Steve Pisani glad to hear you'll be using it - your feedback (via GitHub issue, email, Teams, or carrier pigeon) is certainly welcome!
I know it took a long time to get this out, but better late than never! Shout out to @Sarmishta Velury and Adewale Adewuyi (who I can't tag) for helping to make it happen. :)
Another note on this - there are some new behaviors in recent IRIS versions around the SameSite flag on cookies. (see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/Sa… for general background and https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl… for an explanation of the IRIS changes). This can make cookies behave differently in iframes, doing HTTP redirects, even opening via a link; how you get to a page has a bearing on cookie behavior.
Not sure if that fed into the issue you saw but it's worth noting.
@Chris Marais This means that ^PERFMON or ^%SYS.MONLBL is already running somewhere on the system. If you do ^%SYS.MONLBL it should provide some helpful output/options.
Also a good solution.
Whoa - I had no idea iFind had JSON indexing features. That said, the docs aren't really helpful here. I'll issue another call for @Benjamin De Boe to chime in :)
No, the index that uses BuildValueArray is updated automatically after %Save()/insert/update/etc. The Run() method just demonstrates how the index works, it doesn't do anything special or index-specific.
We've done something similar to this for indexing with JSON paths (in the style of https://goessner.net/articles/JsonPath/) as the keys and the value at that path as the value.
Maybe not simpler, and definitely more complicated if you use a stream rather than a string with MAXLEN="" (which I'll demo below); here's what it ends up looking like:
Class DC.Demo.JSON Extends %String [ ClassType = datatype ]
{
Parameter MAXLEN;
/// Builds value array with subscripts set to values of properties in the JSON stream.
ClassMethod BuildValueArray(value As DC.Demo.JSON, ByRef valueArray As %String) As %Status [ Private ]
{
set sc = $$$OK
try {
set object = {}.%FromJSON(value)
do ..AddObjectToValueArray(object,.valueArray)
} catch e {
set sc = e.AsStatus()
}
quit sc
}
ClassMethod AddObjectToValueArray(object As %DynamicAbstractObject, ByRef valueArray, truncateToLength As %String = 255)
{
set iter = object.%GetIterator()
while iter.%GetNext(.key,.value) {
if $isobject(value) {
do ..AddObjectToValueArray(value,.valueArray)
} else {
set sub = $extract(value,1,truncateToLength)
set valueArray(sub) = ""
}
}
}
}
Class DC.Demo.IndexJSON Extends %Persistent
{
Property JSON As JSON(MAXLEN = "");
Index JSONValues On JSON(KEYS);
ClassMethod Run()
{
try {
do ..%KillExtent()
for json = {"FirstName":"Magnus", "LastName":"Guvenal"},
["Magnus", "Guvenal"],
{
"a":{"b":{"c":"Magnus"
} }} {
set inst = ..%New()
set inst.JSON = json.%ToJSON()
$$$ThrowOnError(inst.%Save())
}
do ..DisplaySQL("select JSON from DC_Demo.IndexJSON where for some %ELEMENT(JSON) (%KEY = 'Magnus')")
do ..DisplaySQL("select JSON from DC_Demo.IndexJSON where for some %ELEMENT(JSON) (%KEY = 'Guvenal')")
do ..DisplaySQL("select JSON from DC_Demo.IndexJSON where for some %ELEMENT(JSON) (%KEY = 'FirstName')")
} catch e {
set sc = e.AsStatus()
write !,$system.Status.GetErrorText(sc)
}
}
ClassMethod DisplaySQL(query, args...)
{
write !,query,!
for i=1:1:$get(args) {
write "argument: ",args(i),!
}
do ##class(%SQL.Statement).%ExecDirect(,query,args...).%Display()
}
Storage Default
{
<Data name="IndexJSONDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>JSON</Value>
</Value>
</Data>
<DataLocation>^DC.Demo.IndexJSOND</DataLocation>
<DefaultData>IndexJSONDefaultData</DefaultData>
<IdLocation>^DC.Demo.IndexJSOND</IdLocation>
<IndexLocation>^DC.Demo.IndexJSONI</IndexLocation>
<StreamLocation>^DC.Demo.IndexJSONS</StreamLocation>
<Type>%Storage.Persistent</Type>
}
}In action:
USER>d ##class(DC.Demo.IndexJSON).Run()
select JSON from DC_Demo.IndexJSON where for some %ELEMENT(JSON) (%KEY = 'Magnus')
JSON
{"FirstName":"Magnus","LastName":"Guvenal"}
["Magnus","Guvenal"]
{"a":{"b":{"c":"Magnus"}}}
3 Rows(s) Affected
select JSON from DC_Demo.IndexJSON where for some %ELEMENT(JSON) (%KEY = 'Guvenal')
JSON
{"FirstName":"Magnus","LastName":"Guvenal"}
["Magnus","Guvenal"]
2 Rows(s) Affected
select JSON from DC_Demo.IndexJSON where for some %ELEMENT(JSON) (%KEY = 'FirstName')
JSON
0 Rows(s) AffectedAnother simpler option would just be using BuildValueArray - see e.g. https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl… (code sample coming...)
Ended up being a simpler solution than expected... the query had been
update table set newfield = 1 where newfield is nulland really should have just been
update %NOINDEX table set newfield = 1(because it was null everywhere).
There's great IDE integration for VSCode for local git repos; really it's the package manager awareness that's key.
Use case: I find a bug in one of my project's dependencies Assuming it's been loaded from my local filesystem rather than by zpm install, I can just fix it directly via an isfs editing mode and it'll be reflected on the filesystem.
Thanks @Ben Spead! And just to be clear, this isn't just for those working in shared, remote development environments - I anticipate this simplifying a lot of my work on Open Exchange projects even with local instances and VSCode.
I wonder if the business host is running an old version of the class. (That would explain why the <UNDEFINED> reports a weird line of code, and why the error hasn't gone away after you fixed it.) Maybe try disabling + reenabling the business operation / restarting the production?