go to post Eduard Lebedyuk · Feb 6 Pythonic way is to use with. In that case close is automatic as soon as we get outsude of the context: ClassMethod ReadFileUsingPython(pFile As %String) [ Language = python ] { from datetime import datetime import iris time1 = datetime.timestamp(datetime.now()) print(time1) if pFile=="": raise Exception("filename is required.") with open(pFile,"r", encoding="utf-8", errors="ignore") as file: log = iris.cls('otw.log.Log') for line in file: status = log.ImportLine(line) time2 = datetime.timestamp(datetime.now()) print(time2) print("Execution time: ",(time2-time1)) }
go to post Eduard Lebedyuk · Feb 5 Try to open your file like this: file = open(pFile, "r", encoding="utf-8", errors="ignore") Docs.
go to post Eduard Lebedyuk · Jan 27 For cross-namespace queries the easiest way is to map packages/globals but that might not be a recommended approach for an audit table. You can do this: In your production namespace create a new table with the same structure as your audit select query backed by PPG storage. Switch to the audit namespace. Run audit query, iterate the results and write them into the PPG. Switch into a production namespace. Run query against your PPG table, joining any local tables.
go to post Eduard Lebedyuk · Jan 26 Enable %Ensemble/%Production/ModifyConfiguration in System Audit Events: After that you should see these events:
go to post Eduard Lebedyuk · Jan 25 Try to export the project with one deployed class. Open exported xml and check if the class is there and deployed.
go to post Eduard Lebedyuk · Jan 25 Use args... to supply a variable number of parameters: ClassMethod DoCleverStuf(args...) As %Status [ CodeMode = objectgenerator ] { do %code.WriteLine(" For i=1:1:args {") do %code.WriteLine(" Write args(i)") do %code.WriteLine(" }") do %code.WriteLine(" Set tSC = $$$OK") ... } can I generate a whole method at compile time? You can use projections to do that. Here's an example.
go to post Eduard Lebedyuk · Jan 20 Assuming you have a sync mirror established, adding new db to mirror is as simple as: Create DB on Primary. Run SYS.Mirror:AddDatabase. It returns %Status, check that it's ok with $$$ISOK(sc). It should be equal to 1. Dismount database on Primary (using SYS.Database:DismountDatabase) OR Freeze IRIS (Backup.General:ExternalFreeze). Copy IRIS.DAT to Backup. Mount database on Primary (using SYS.Database:MountDatabase) OR Thaw IRIS (Backup.General:ExternalThaw). Mount database on Backup. Activate database on Backup (SYS.Mirror:ActivateMirroredDatabase). Catchup database on Backup (SYS.Mirror:CatchupDB). Please note that some methods accept db name, most accept db directory, and others db sfn. Please keep that in mind.
go to post Eduard Lebedyuk · Jan 18 Try: ##class(%Studio.Project).InstallFromFile( "/display=none /displaylog=0 /displayerror=0")
go to post Eduard Lebedyuk · Jan 11 Database is a physical file containing globals. Namespace is a logical combination of one or more databases. By default Namespace has two databases: GLOBALS - default location for globals ROUTINES - default location for code (classes/routines/includes) In addition to that, namespace can have any amount of mappings. Mappings map specified globals/code from a specified database. When you try to access a global, first global mappings are searched for this global, if no mappings are found, the GLOBALS database is used. When you try to access some code, first package/routine mappings are searched for this code, if no mappings are found, the ROUTINES database is used. To split data innto a separate DB: Create target DB. Make source DB RO (by forcefully logging users out for example and/or marking it as RO). Copy data/code from the source to target DB (for globals use ^GBLOCKCOPY). Create mapping from the target DB to your namespace. Confirm that data is present. Delete data from a source DB.