Dmitry Maslennikov · May 14, 2023 go to post

with zpm you can use additional parameter for it

zpm "test module-name -only -D UnitTest.Case=Test.PM.Unit.CLI:TestParser"

Use class name only to run all tests there, or add Method name to test only that method in the class

Dmitry Maslennikov · May 14, 2023 go to post

There are no reasons for them to be ClassMethods, UnitTests is quite a complex thing, and it's there are use-cases where it needs to be this way.

I've added support for IRIS to the migration tool Alembic based on SQLAlchemy 

And with this support, Apache Superset can completely operate on IRIS, not just for analyses, but just for its own Superset's needs too.

well, ok, yeah, I did not notice it. But still, the usage per process is still an important part. And even if the leakage is real, it may happen in ZPM itself. The testing scenario does not look like proof much, installing and uninstalling zpm multiple times does not like a real scenario.

Have a look at what will show this query, the result in KB

echo 'select sum(memorypeak) memorypeak,sum(MemoryUsed) memoryused from %SYS.ProcessQuery' | iris sql iris
Dmitry Maslennikov · Apr 28, 2023 go to post

I think you forgot about memory per process, which I would say is not limited at all by default anymore. So, your "leaks", may happen in the processes. ZPM is quite a big package, and the installation will use multiple processes.

So, having most of the memory just mostly for buffers does not work for IRIS, while you need room for the processes, and if you would go to production, you have to have in mind how many active users you would expect and decide how much memory they will consume.

Dmitry Maslennikov · Apr 27, 2023 go to post

You can also use SAM, or plain Grafana for it, which is more suitable for real-time dashboards

And I've recently introduced IRIS support to Apache Superset, which now can be used to show charts on plain SQL tables.

Dmitry Maslennikov · Apr 24, 2023 go to post

There is no way, to catch the possible issues for the previous version of IRIS.

The best case scenario is if you automate the build process, for instance with Docker, and test a compile stage on different versions of IRIS. But the ability to successfully compile may not prove that it will work, it would be better to have some unit tests, which will check it.

One more thing, may help, to check it, using the such tool as ObjectScript Quality, can help with checking System's API version. Where you can set the oldest supported version of IRIS, and during the scan, it can check if Methods are available in that particular version.

Dmitry Maslennikov · Apr 10, 2023 go to post

Some scenarios may require the ability to insert a new row with IDENTITY not default, and in this case you would need to use ALLOWIDENTITYINSERT = 1

CREATE TABLE (..) WITH %CLASSPARAMETER ALLOWIDENTITYINSERT = 1;

Some additional details here

Dmitry Maslennikov · Apr 10, 2023 go to post

Or just add this to the end of docker run command

-a "iris session iris -U%SYS '##class(Security.Users).UnExpireUserPasswords(\"*\")'"

It's a bit more complicated for this task.

It always should return the full datetime, for instance if I trunc to quarter, it should return 2023-04-01 for the current day

Implemented it with SQL Procedure

CREATE OR REPLACE PROCEDURE %ZDJANGO.CLONE_DATABASE(sourceNS %String, targetNS %String)
LANGUAGE OBJECTSCRIPT
{
	new $namespace
	set $namespace = "%SYS"
	
	$$$ThrowOnError(##class(Config.Namespaces).Get(sourceNS, .sourceNSparams))
	$$$ThrowOnError(##class(Config.Namespaces).Get(targetNS, .targetNSparams))
	
	for kind="Globals", "Routines" {
		$$$ThrowOnError(##class(Config.Databases).Get(sourceNSparams(kind), .sourceDBparams))
		$$$ThrowOnError(##class(Config.Databases).Get(targetNSparams(kind), .targetDBparams))
		
		set from = sourceDBparams("Directory")
		set to = targetDBparams("Directory")
		
		quit:$Data(done(to))
		set done(to) = "" 
		
		$$$ThrowOnError(##class(SYS.Database).Copy(from, to, , , 4))
	}
} 

DANGER: Do not use it, made specifically for my case, it may overwrite database

The issue is in quotes, try some other combination. Your whole call in single quotes, then you don't need to escape double quotes inside

Python WON

One of the winner's articles uses my project SQLAlchemy-IRIS. And one more could use it too, and there is an example with it in the comments.

You can do this query

SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES                   
WHERE TABLE_TYPE='BASE TABLE'

Filter by TABLE_TYPE is to get rid of system tables

Example of using SQLAlchemy+Pandas, works with this Cloud SQL as well

from sqlalchemy import create_engine
import pandas as pd

server = '<your-server-hostname>'
port = 1972
namespace = 'USER'
username = 'SQLAdmin'
password = '<YOUR_PASSWORD>'

url = f"iris://{username}:{password}@{server}:{port}/{namespace}"
print(url)
engine = create_engine(url)

df = pd.DataFrame({
    'int': [1, 2, 3, 4, 5],
    'float': [1.1, 2.2, 3.3, 4.4, 5.5],
    'string': ['a', 'b', 'c', 'd', 'e'],
    'datetime': pd.date_range('20130101', periods=5),
    'bool': [True, False, True, False, True]
})

# create a table in IRIS
df.to_sql('iris_table', engine, if_exists='replace', schema='sqlalchemy')

# read the table back from IRIS 
df2 =  pd.read_sql_table('iris_table', engine, schema='sqlalchemy')
# print the dataframe
print(df2)