#Namespace

0 Followers · 84 Posts

A namespace is a logical entity which provides access to data and to code, which is stored in multiple databases.

Article Ariel Glikman · Jan 13, 2025 3m read

You may have noticed that to configure a mirror for InterSystems IRIS for Health and HealthShare® Health Connect there is a special requirement. I wanted to go through it step by step in this article.

This assumes you have already configured the second failover member and confirmed a successful failover member status in the mirror monitor:

Step 1:Enable HS_Services user (on backup and primary

Step 2: Switch to Namespace HSSYS and go to Interoperability > Configure > Credentials. Enter the Password for your predefined HS_Services user (on backup and primary)

2
6 380
Article Andrew Sklyarov · Nov 2, 2025 7m read

Over time, while I was working with Interoperability on the IRIS Data Platform, I developed rules for organizing a project code into packages and classes. That is what is called a Naming Convention, usually. In this topic, I want to organize and share these rules. I hope it can be helpful for somebody.

 

4
2 82
Question Yone Moreno Jiménez · Aug 5, 2025

Hello, how are you?

First of all thanks for your time reading this question.

We are investigating how to validate the indexes of a global. We have read:

https://docs.intersystems.com/irisforhealth20251/csp/docbook/DocBook.UI…

And:

https://docs.intersystems.com/irisforhealth20251/csp/documatic/%25CSP.D…

We want to validate the inxedes of the global titled "Ens.Util.LogD". We have executed on the ObjectScript terminal, on the desired namespace:

2
0 69
Article Guillaume Rongier · Jul 24, 2025 5m read

img

Modules what a topic! We don't have this notion in ObjectScript, but it's a fundamental concept in Python. Let's discover it together.

What is a Module?

I see modules as an intermediate layer between classes and packages. Let see it by example.

A bad example :

# MyClass.py
class MyClass:
    def my_method(self):
        print("Hello from MyClass!")

When you try to use this class in another script, you would do:

# class_usage.py
from MyClass import MyClass # weird, right?

my_instance = MyClass()
my_instance.my_method()

Why this is a bad example?

First because file names should be in snake_case according to PEP 8, so it should be my_class.py. Second, because you are importing a class from a file that has the same name as the class. This is not a good practice in Python.

I know this can be confusing, especially if you come from ObjectScript where classes are defined in files with the same name as the class.

Advanced notions

A Module is a Python File

So we just saw that modules can be a python file but without the .py extension.

But wait, does it mean that a python script is a module too? Yes, it is!

That's why you should be careful when importing a script, because it will execute the code in that script. See the Introduction to Python article for more details.

A Module is a Folder with an __init__.py File

Wow, can a folder be a module? Yes, it can!

A folder can be a module if it contains an __init__.py file. This file can be empty or contain initialization code for the module.

Let's see an example:

src/python/article/
└── my_folder_module/
    ├── __init__.py
    ├── my_sub_module.py
    └── another_sub_module.py
# my_folder_module/my_sub_module.py
class MySubModule:
    def my_method(self):
        print("Hello from MySubModule!")
# my_folder_module/another_sub_module.py
class AnotherSubModule:
    def another_method(self):
        print("Hello from AnotherSubModule!")
# my_folder_module/__init__.py
# This file can be empty or contain initialization code for the module.

In this case, my_folder_module is a module, and you can import it like this:

from my_folder_module import my_sub_module, another_sub_module

Or if you define an __init__.py file with the following content:

# my_folder_module/__init__.py
from .my_sub_module import MySubModule
from .another_sub_module import AnotherSubModule

You can import it like this:

from my_folder_module import MySubModule, AnotherSubModule

You see the subtility? You can import the classes directly from the module without specifying the sub-module, because the __init__.py file is executed when you import the module, and it can define what is available in the module's namespace.

sys.path

When you import a module, Python looks for it in the directories listed in sys.path. This is a list of strings that specifies the search path for modules.

You can view the current sys.path by running the following code:

import sys
print(sys.path)

By default, it includes the current directory and other various directories depending on your Python installation.

You can also add directories to sys.path at runtime, which is useful when you want to import modules from a specific location. For example:

import sys
sys.path.append('/path/to/your/module')
from your_module import YourClass

This is why in the previous article, we added the path to the module before importing it:

Set sys = ##class(%SYS.Python).Import("sys")
do sys.path.append("/irisdev/app/src/python/article")
set my_module = ##class(%SYS.Python).Import("my_module")

sys.path and the other directories

What are the other directories in sys.path? They are usually:

  • The directory containing the input script (or the current directory if no script is specified).
  • The standard library directories, which contain the built-in modules that come with Python.
  • site-packages directories where third-party packages are installed.

site-packages

How site-packages works? When you install a package using pip, it is installed in the site-packages directory, which is automatically included in sys.path. This allows you to import the package without having to specify its location.

🤨🔍 But how and where the site-packages directory are set and by who?

The site-packages directory is created during the installation of Python and is typically located in the lib directory of your Python installation. The exact location depends on your operating system and how Python was installed.

For example, on a typical Linux installation, the site-packages directory might be located at:

/usr/local/lib/python3.x/site-packages

On Windows, it might be located at:

C:\Python3x\Lib\site-packages

When you install a package using pip, it is installed in the site-packages directory, which is automatically included in sys.path. This allows you to import the package without having to specify its location.

import site
print(site.getsitepackages())

🤨🔍 When and where python interpreter reads the site.py file?

The site.py file (which is located in the standard library directory) is executed automatically when the Python interpreter starts. It is responsible for setting up the site-packages directory and adding it to sys.path. This file is located in the standard library directory of your Python installation.

sys.path in IRIS

In IRIS, we also have a site.py file, which is located in <installation_directory>/lib/python/iris_site.py. This file is executed when you start or import aa script/module in IRIS, and it sets up the sys.path for you.

Roughly, the iris_site.py file does the following:

Conclusion

A module can be :

  • a Python file (with or without the .py extension)
  • a folder with an __init__.py file
  • a Python script (which is also a module)
  • if you can't import a module, check if it is in the sys.path list
0
2 125
Article Myles Collins · Jul 22, 2025 7m read

Are you familiar with SQL databases, but not familiar with IRIS?  Then read on...

About a year ago I joined InterSystems, and that is how IRIS got on my radar.  I've been using databases for over 40 years—much of that time for database vendors—and assumed IRIS would be largely the same as the other databases I knew.  However I was surprised to find that IRIS is in several ways quite unlike other databases, often much better.  With this, my first article in the Dev Community, I'll give a high-level overview of IRIS for people that are already familiar with the other databases such as Oracle, SQL Server, Snowflake, PostgeSQL, etc.   I hope I can make things clearer and simpler for you and save you some time getting started.

1
1 237
InterSystems Official Daniel Palevski · Jun 9, 2025

InterSystems has released new point updates to resolve a defect affecting the most recent prior versions of 2025.1.0, 2024.1.4, 2023.1.6, and 2022.1.7, for the following supported product lines:

  • InterSystems IRIS
  • InterSystems IRIS for Health
  • HealthShare Health Connect

This issue could result in unexpected <PROTECT> errors or access anomalies when using features such as:

  • Implied namespaces
  • Mixed read-only/read-write access to databases
  • Management Portal pages for listing routines and globals

Symptoms Included:

1
0 129
Question Scott Roth · Jun 11, 2025

I have created a New Database/Namespace within our TEST environment on both the Primary and Backup of the mirror. When I go to create the database/namespace on the DR node I am getting "Cannot open file '/ensemble/TEST/iris.cpf_...." while the cpf file that it references does not exist. Anyone have any clue to why this might be happening?

3
0 87
Announcement Andreas Schneider · May 25, 2025


I'm excited to announce a major update to SQL Data Lens – a powerful database client and metadata explorer – that opens up new, free possibilities for the InterSystems community.

SQL Data Lens is now completely FREE to use with InterSystems IRIS Community Edition!

No more “localhost only” restrictions
No more limits on the number of connections

No license? No problem.
You can now connect to InterSystems IRIS Community Edition—completely license-free—using the fully functional Free Edition of SQL DATA LENS. Explore all the features, no strings attached.
 

1
0 93
Question Bransen Smith · Oct 1, 2024

I have the class ConfigUtils.ConfigSettingsTable, which is a persistent object.  I know I need to map packages from the original namespace. In this case, I have mapped ConfigUtils.ConfigSettingsTable from the originating namespace (IRISTST database) across all other namespaces.

With this, I am able to see the table ConfigUtils.InstanceSettings in SQL Explorer in each namespace, but the same data is not shared across environments. For example, in the MAINTENANCE namespace, I can see the table, but I don't see the same information that I see in the table in the original IRISTST namespace.

8
0 200
Article Joe Fu · Mar 7, 2025 2m read

We recently changed the 'UserID" property in a "User" class from type of %String to be %Library.Username. This is for better consistency across our codebase regarding MAXLEN limit.

%Library.Username is a system wrapper datatype which extends %String and has a MAXLEN of 160. This change should have minimal/no impact on code behavior. However, we found that some SQL query cannot return expected rows after the change. Query will return empty values even if the entry is in the table.

3
0 106
Article Andreas Schneider · Jan 12, 2025 1m read

Hi! I've extended my demo repository, andreas5588/demo-dbs-iris, to make it easy to test the FOREIGN SERVER and FOREIGN TABLE features in IRIS.

To achieve this, I created a namespace called FEDERATION. The idea is as follows:

  1. Set up JDBC connections for each namespace.
  2. Create a FOREIGN SERVER within the FEDERATION namespace for each connection.
  3. Define a FOREIGN TABLE a least for one table based on each foreign server.

The Script:  demo-dbs-iris/src/sql/02_create_foreign_server.sql

3
1 253
Question Kurro Lopez · Oct 28, 2024

Hi all.

I hope you can help me.

I've renamed a namespace and its databases names.

  • Old Namespace: LABORATORIO
  • New namespace: SRV-LABORATORIO

The rename of all has worked fine. When I've tried to access to the portal, it is no available, displaying the message "Tha namespace SRV-LABORATORIO does not support productions"

So, I've run the following command in terminal

zn"SRV-LABORATORIO"do##class(%EnsembleMgr).EnableNamespace($namespace)

My IRIS has created the links to create the production.

Now, I've opened the portal but my code has disappear.

2
0 207
Article Robert Cemper · Sep 12, 2024 2m read

During testing the added Multi-Namespace feature I met a challenge
that required intervention. This simple request created 1000 lines of output.

USER>do^rcc.find
----------------
 
enter search string [$ZU] <blank> to exit:
          Verbose? (0,1) [0]:
          Force UpperCase? (1,0) [1]:
 
enter code type (CLS,MAC,INT,INC,ALL) [ALL]:
 
select namespace (ALL,%SYS,DOCBOOK,ENSDEMO,ENSEMBLE,SAMPLES,USER) [USER]: all
  • As for the verbose variant you my run a log on your terminal to keep the result in details
  • though a real summary was still missing.
0
2 186
Question Scott Roth · Sep 2, 2024

Currently we are exploring how we can allocate additional disk space to our current environment as we have seen a significant increase in growth of our Database files. Currently we have 3 namespaces, all with 1 IRIS.dat each that contains both the Global and Routines.

Since we have started down the route of everything within a single IRIS.dat file for each namespace, is it logical as we see growth to be able to split the current IRIS.dat for each namespace into a separate IRIS.dat for global and a IRIS.dat with for routines for each namespace in a Mirror environment?

4
0 260
Question Julian Matthews · Jul 16, 2024

Hi all.

Recently, I have noticed Scott Roth's mission to resolve issues with Orphaned messages with a lot of focus on prevention, and I envy that level of dedication.

Not wanting to be left out, this has sparked an interest in checking my environments for orphaned messages. Amongst a few different posts on the subject, I came across this post from Suriya Murugan in 2016 that included an interesting class in a Github Gist that seems to be built to do a deep dive into the identification and cleanup of Orphaned Messages.

10
0 356
Article Daniel Aguilar · Jul 13, 2024 3m read

   

📜 Santa Tecla, verse 8: "Hover your mouse over the screen, and the sea of data will open a path before you!!"

Hello community, first of all, apologies if anyone was offended by the blasphemy 😔

Have you ever thought it would be interesting to have the source code separated from the database data? Perhaps you'd like to be able to back up your code without copying gigabytes of client data.

Below, I'll explain the steps to separate your sea formed by the source code and data into two different databases within a namespace.

0
0 380
Article Guillaume Rongier · Jul 8, 2024 3m read

wsgi_logo

Context

The Web Server Gateway Interface (WSGI) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. WSGI is a Python standard described in detail in PEP 3333.

🤔 Ok, great definition and what the point with iris ?

IRIS 2024.2+ has a new feature that allows you to run WSGI applications directly on IRIS. This feature is a great way to integrate IRIS with other Python frameworks and libraries.

This goes in the trend of Python first experience, where you can use Python to interact with IRIS, and now you can also run Python applications directly on IRIS.

How to use it

To instantiate a WSGI application on IRIS, you need to configure it in the Security->Applications->Web Applications section of the IRIS Management Portal.

Simple flask example:

File called app.py in /irisdev/app/community directory:

from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

UI Configuration

image

In this section, you can configure the WSGI application by providing :

  • Aplication Name

  • this corresponds of the file name of the WSGI application

  • ex: app.py but without the .py extension : app

  • Callable Name

    • the callable function that will be called by the WSGI server

    • ex: app corresponds to the app variable in the app.py file

      • app = Flask(__name__)
  • WSGI App directory

    • the path where the WSGI application is located
    • ex: /irisdev/app/community
  • Python Protocol Type

    • it can be wsgi or asgi
      • wsgi is the default value and the one used in this example
      • asgi is for asynchronous applications
        • we support asgi syncrhonously for now with the a2wsgi adapter
  • DEBUG

    • if checked, the WSGI application will run in debug mode
      • this is useful for development purposes as any changes to the WSGI application will be automatically reloaded

CPF Merge

You can also configure the WSGI application using CPF. Here is an example of the configuration:

[Actions]
CreateApplication:Name=/flask,NameSpace=IRISAPP,WSGIAppLocation=/irisdev/app/community/,WSGIAppName=app,WSGICallable=app,Type=2,DispatchClass=%SYS.Python.WSGI,MatchRoles=:%ALL,WSGIDebug=0,WSGIType=0

Log Files

The WSGI application logs are stored in the WSGI.log file located in the mgr directory of the instance.

Examples

Here are some examples of WSGI applications that you can run on IRIS, they aim to show how to run different Python frameworks on IRIS.

Basically, the use case will be the same for all the frameworks:

Endpoints

  • /iris - Returns a JSON object with the top 10 classes present in the IRISAPP namespace.
  • /interop - A ping endpoint to test the interoperability framework of IRIS.
  • /posts - A simple CRUD endpoint for a Post object.
  • /comments - A simple CRUD endpoint for a Comment object.

Object Model

Post object:

  • id
  • title
  • content

Comment object:

  • id
  • post_id (foreign key to Post)
  • content

Flask

Django

FastAPI

Limitations

  • The ASGI is supported synchronously for now with the a2wsgi adapter.
  • tornado applications ( jupyter, streamlit, .. ) are not supported as they are not WSGI compliant.
0
0 545
Question Anna Golitsyna · May 2, 2024

I am trying to locate a method that would allow me to differentiate between InterSystems preinstalled/system namespaces and "our own" namespaces. I am interested both in Cache and Iris answers if they are different. Yes, I can list what to disregard, like if not HSLIB or if not DOCBOOK but hoping for a more universal and elegant answer.

3
0 226
Question Marcel den Ouden · Apr 4, 2024

My VSCode folder was set up to connect to a namespace, but the namespace was deleted. I tried changing the namespace from the menu but it fails (could not retrieve list of namespaces), but I do get the following error message:

This server does not have specified namespace 'FEAT-1-MY-FIRST-ISSUE'.

You must select one of the following: %SYS, CICD-DEMO, CUSTOMER, HSCUSTOM, HSLIB, HSSYS, PERSONAL, PHONEBOOK, USER.

Check your server details in Settings (gitlab-cicd-dev[FEAT-1-MY-FIRST-ISSUE]).
9
0 346
Question Julian Matthews · Apr 8, 2024

Hi everyone.

Is there a sensible approach to having a lookup table in Namespace A, and then accessing this from Namespaces B, C, D (etc)?

I'm trying to avoid creating a Global mapping of the lookup table global (^Ens.LookupTable) as I fear that it would then link all other lookups in that global and lead to some unexpected behaviour, but would be open to trying something in this realm if it's the best option.

Another approach I have considered is creating a custom lookup function that is run from the secondary namespaces that does some namespace hopping, but it feels messy. Something like:

4
0 349
Article Ewan Whyte · Mar 19, 2024 3m read

Introduction

There is a Link Procedure Wizard option within the Management Portal (System > SQL >Wizards > Link Procedure) which I had reliability issues with so I decided to use this solution instead.

Problem

You need to query an external SQL database to use the response within a namespace. This guide is assuming that you already have a working stored procedure in SSMS although you could instead use a SQL block within the operation. Stored procedures in SSMS are preferred to maintain integrity, Embedded SQL can get very confusing if you have a complicated SQL statement.

2
1 457
Article Muhammad Waseem · Mar 10, 2024 6m read

Introduction

Visual Studio Code (VS Code) is a free source code editor made by Microsoft for Windows, Linux, and macOS. It provides built-in support for JavaScript, TypeScript, and Node.js. You can add extensions to provide support for numerous other languages including ObjectScript.

The InterSystems extensions enable you to use VS Code to connect to an InterSystems IRIS server and develop code in ObjectScript. The Visual Studio Code Documentation is an excellent resource on VS Code, so it is a good idea to be familiar with it.

5
5 646
Question Pierre LaFay · Feb 4, 2024

Hello everyone,

I am looking for the syntax or the way to use a class created in the "BNA" Namespace (my application) from the %SYS Namespace.

Here is the context:

I have a "BNA" application contained in the "BNA" NS, this application provides a user creation functionality. This feature creates both the user in a table in the application and in the Iris system.

9
0 553
Question Luis Angel Pérez Ramos · Jan 10, 2024

I just realized that for the latest version of IRIS for Health 2023.3 the method InstallFoundation from HS.HC.Util.Installer has just disappear. I checked the official documentation (here) but I can't find any reference to it like in previous versions (here).

Is there anyway to create it by code?

3
0 301
Question Kurro Lopez · Jan 31, 2024

Hi community,

We have a developed a new version of a production, all the code is new and has changed BP. This application load information for some brands and stored in database.

The customer wants to implement the changes only for some brands because he wants to check for small brands before to implement for all brands.

My proposal is create a new namespace, with the new code, and disabled all load of brands except the brand that he wants to check.

I'm wondering what is the best way to clone the namespace.

2
0 390