#Embedded Python

4 Followers · 292 Posts

Embedded Python refers to the integration of the Python programming language into the InterSystems IRIS kernel, allowing developers to operate with data and develop business logic for server-side applications using Python.

Documentation.

Article Henry Pereira · Aug 2, 2021 8m read

Easy, easy, I'm not promoting a war against the machines in the best sci-fi way to avoid world domination of Ultron or Skynet. Not yet, not yet 🤔

I invite you to challenge the machines through the creation of a very simple game using ObjectScript with embedded Python.

I have to say that I got super excited with the feature of Embedded Python on InterSystems IRIS, it's incredible the bunch of possibilities that opens to create fantastic apps.

Let's build a tic tac toe, the rules are quite simple and I believe that everyone knows how to play.

That's what saved me of the tedium in my childhood d

https://media4.giphy.com/media/mBpthYTk5rfbZvdtIy/giphy.gif?cid=790b761181bf3c36d85a50b84ced8ac3c6c937987b7b0516&rid=giphy.gif&ct=g

8
5 1605
Question Evgeny Shvarov · Oct 8, 2022

Folks!

Could you please share any best practices on how to debug Embedded Python code?

Given I have the following class method:

ClassMethod HideShip() As %Status [ Language = python ]
{
    import iris
    shipsgl=iris.gref(iris.cls(__name__)._GetParameter("BoardStorage"))
    shipsgl.kill()
    from random import Random
    board=iris.cls(__name__)._GetParameter("BoardRange")
    x=random.randint(0,board+1)
    y=random.randint(0,board+1)
    shipsgl.set([x,y],1)
}

And when I run it shows the following error:

USER>d ##class(eshvarov.sample.SeaBattle.GamePython).HideShip()

5
0 997
Question Evgeny Shvarov · Oct 6, 2022

Hi folks!

I'm working with a global via Embedded Python as a class method. I init the handler for a global via:

gl=iris.gref("^Global")

What is the way to check the value at index ^Global("x","y")? E.g.:

In ObjectScript I'd do the following:

set result=$data(^Global("x","y"))

How do I do the same in Embedded Python?

I checked the documentation, but haven't found an answer.

4
0 313
Announcement Olga Zavrazhnova · Oct 6, 2022

Hi Community, 

Join us for an InterSystems Developer Meetup during TechCrunch Disrupt 2022!

We’ll be meeting on Wednesday, October 19th at Bartlett Hall, located at 242 O’Farrell St. (just a few short blocks from the Moscone Center) starting at 6 pm through 8:30 pm PT, where speakers will discuss how developers can bring the code to the data, not data to the code with Embedded Python and Integrated ML on InterSystems IRIS.

Food and drinks will be served accompanied by discussions. 

Agenda:

0
0 364
Article Guillaume Rongier · Sep 30, 2022 8m read

grpc-iris-interop

The aim of this proof of concept is to show how the gRPC protocl can be implemented with the IRIS ineroperabilty module.

architecture

image

On this schema, we can see that the gRPC Service is hosted by IRIS.

This service must invoke the IRIS interoperability module. For that it transforms the protobuf messages to IRIS messages.

The gRPC client is host by a Flask server for demo purpose, the gRPC client can also be invoke by the python script.

definition of each file

users.proto

syntax = "proto3";
package users;

service Users {
  rpc CreateUser (users.CreateUserRequest) returns (u
0
1 711
Article Guillaume Rongier · Sep 27, 2022 2m read


 

You may know it but IRIS is a database with the ability to execute code.

The code execution part is called an Application Server.

Today IRIS supports natively two languages: ObjectScript and Python.
Executing code is good, knowing how to organize it is better.


Organizing code is software architecture, not everyone has the desire or knowledge to create such a solution.
To do this, many programming languages offer what we call Frameworks.
These frameworks help us (the developers) to architect our code, to organize it, to foresee scalability, to foresee the dissociation between technical logic

0
0 310
Article Jimmy Xu · Sep 26, 2022 3m read

Hi Developers,

Python has a large and powerful ecosystem that contains thousands of libraries and packages available, especially in data science.

Therefore, I wanted to have a first try in using a recent feature of IRIS called Embedded Python, to simply import a python library called datetime, generate data with a timestamp component and persist it in InterSystems IRIS for Health Data Platform. The same will work on IRIS Data Platform as well.

5
1 491
Question Guillaume Rongier · Sep 23, 2022

Hello,

I'm looking for a way to write a stored procedure or something to return a ResultSet with Embedded Python.

My goal is the following:

I have a Goal table with a Text field that is free text.

CREATETable Goal (
    Idint,
    TextVARCHAR(5000)
);


I would like to create a procedure that returns all the entities (in the iKnow sense) in a new Entity column.

Python code, i would like to use :

import iknowpy

engine = iknowpy.iKnowEngine()

# Row to parse
text = 'This is a test of the Python interface to the iKnow engine. another sentence to test this program with.'
engine.i
5
0 469
Article Muhammad Waseem · Sep 13, 2022 5m read

Hi Community,
In this article I will demonstrate the functionality of my app iris-energy-isodata .  
Application is accessing energy data (production, demand and supply)  from the major Independent System Operators (ISOs) in the United States to ensure sustainable consumption and production patterns (SDG's 12)

Application is using python library isodata , Production EXtension PEX  along with Embedded Python.  Special Thanks to @Guillaume Rongier for the template  template for guidance

Below is the list of Independent System Operators(ISOs)

  1.  California ISO (caiso)
  2.  PJM (pjm)
  3.   ISO New En






image

2
0 379
Article Veerarajan Karunanithi · Jul 12, 2022 10m read

Date and Time is an important factors in our life. Because all applications are engaging based on Date/Time. But our world is split into multiple time zones. if our product is launched in the world, to maintain the history of events we are definitely required to convert all times to our local time or UTC ( Coordinated Universal Time ). As I know, many known programming languages of C#, JavaScript, Java, etc., provided the library to convert the date and time. i.e with a time zone name we can be able to convert without knowing the UTC offset.

TZ database doesn't exist in InterSystems produc

1
0 792
Article José Pereira · Dec 27, 2021 12m read

In the previous articles, we learned the basics of using IMAP protocol to handle messages from mailboxes in an e-mail server. That was cool and interesting, but you could take advantage of implementations created by other ones, available in libraries ready to use.

One of the improvements to the IRIS data platform is the ability to write Python code alongside ObjectScript in the same IRIS process. This new feature is called Embedded Python. Embedded Python lets us bring to our ObjectScript code the power of the huge Python ecosystem’s libraries.

In this article, we’ll use one of those libraries

1
1 740
Announcement Evgeny Shvarov · Aug 29, 2022

Hi Developers!

Here're the technology bonuses for the InterSystems "Sustainability" Interoperability Contest 2022 that will give you extra points in the voting:

  • Sustainability Topic
  • Sustainability Dataset
  • Business Process BPL or Business Rule DTL Usage
  • Custom Interoperability Adapter
  • Production EXtension(PEX) Python, Java, or .NET usage
  • Embedded Python usage
  • Docker container usage
  • ZPM Package Deployment
  • Online Demo
  • Code Quality pass
  • Article on Developer Community
  • The second article on Developer Community
  • Video on YouTube

See the details below.<--break-><--break->

1
0 336
Article Yuri Marx · Aug 8, 2022 24m read

In this article you will have access to the curated base of articles from the InterSystems Developer Community of the most relevant topics to learning InterSystems IRIS. Find top published articles ranked by Machine Learning, Embedded Python, JSON, API and REST Applications, Manage and Configure InterSystems Environments, Docker and Cloud, VSCode, SQL, Analytics/BI, Globals, Security, DevOps, Interoperability, Native API. Learn and Enjoy!

Machine Learning

Machine Learning is a mandatory technology to build advanced data analysis and automate manual activities with excellent efficiency. It

6
7 1159
Discussion Dmitry Maslennikov · Aug 3, 2022

I am aware that we have 5 License Units on Community Edition. But I have issues figuring out how it's working.

I have Community Edition

USER>write $system.License.KeyCustomerName()
InterSystems IRIS Community

Freshly started system, only terminal session open, so, only one license units used, and 4 left. As expected

USER>write $system.License.LUConsumed()
1
USER>write $system.License.LUAvailable()
4

Quote from documentation - $SYSTEM.License.MaxConnections() returns the maximum number of connections a user can make while consuming one license unit. 

USER>write $system.License.MaxConnections()
25
16
1 781
Article Dmitry Maslennikov · Jul 30, 2022 5m read

Continuing to  observe the possibilities of Django, and usage with IRIS. The first we have looked how to define models and connect to tables already existing in IRIS, than we extended embedded Django Administration portal, with an ability to see what data we have in that models, with filters, editing and even pagination.

Time to go to real action, now we a going to create some REST API, on Django, based on the same data, we used before from the package posts-and-tags.

To do so, we will use Django REST Framework

Django REST Framework

Django REST framework is a powerful and flexible toolkit for building Web APIs.

Some reasons you might want to use REST framework:

  • The Web browsable API is a huge usability win for your developers.
  • Authentication policies including packages for OAuth1a and OAuth2.
  • Serialization that supports both ORM and non-ORM data sources.
  • Customizable all the way down - just use regular function-based views if you don't need the more powerful features.
  • Extensive documentation, and great community support.
  • Used and trusted by internationally recognised companies including Mozilla, Red Hat, Heroku, and Eventbrite.
0
0 475
Article Lucas Enard · Jul 27, 2022 7m read

Following this GitHub we will see how the FIX protocol can be implemented easily using IRIS and Python.

If you don't have much time focus on the Send a Quote before the Order part near the end, as it will, in a matter of minute, tell you how to send a Quote Request followed by an Order Request and show you the result from the server, and that in no more than five clicks.

IRIS-fix-protocol

Implementation of the fix protocol using an IRIS python container for the initiator and a regular python container for the acceptor.

The Financial Information eXchange (FIX®) Protocol has revolutionized the

4
0 1124
Article Oliver Wilms · Jul 25, 2022 3m read

Hello,

I became aware of Python in the early 2000s when I started automating tasks. Some of our processes utilized python scripts. I never figured it out very well, and we decided to do away with Python because nobody on our team was familiar with it.

Along the way, I heard a lot about Python. My interest was renewed when InterSystems offered bonus points for using Python in contests.

The things I like the most about Python so far is how easy it is to find the mean of the ages of all Titanic passengers. For my test-data app I wanted to find the largest value in the ‘Qty’ column in a CSV fil

0
0 322
Announcement Olga Zavrazhnova · Jul 11, 2022

Hi Community,

We are excited to announce that InterSystems Developers Meetups are finally back in person!

The first Python-related meetup will take place on July 21 at 6:00 at Democracy Brewing, Boston, MA. There will be 2-3 short presentations related to Python, Q&A, networking sessions as well as free beer with snacks and brewery tours.

AGENDA:

0
0 477
Announcement Dmitry Maslennikov · Jan 13, 2022

I think it's a known fact that Populate Utility has very limited functionality. It supports only one language and one country. The list of possible values does not have so many options. 

There is a kind of tool that now can help with it, named Faker. It has implementations in different languages, including Python. Since IRIS has now had the Embedded Python feature, Python faker can be implemented in IRIS.

3
0 344
Article Lucas Enard · May 3, 2022 44m read


This formation, accessible on my GitHub, will cover, in half a hour, how to read and write in csv and txt files, insert and get inside the IRIS database and a distant database using Postgres or how to use a FLASK API, all of that using the Interoperability framework using ONLY Python following the PEP8 convention.

This formation can mostly be done using copy paste and will guide you through everystep before challenging you with a global exercise.
We are available to answer any question or doubt in the comment of that post, on teams or even by mail at lucas.enard@intersystems.com .

We would






























































































RESTResults

1
1 832
Article José Pereira · Apr 5, 2022 4m read

Motivation

This project was thought of when I was thinking of how to let Python code deal naturally with the scalable storage and efficient retrieving mechanism given by IRIS globals, through Embedded Python.

My initial idea was to create a kind of Python dictionary implementation using globals, but soon I realized that I should deal with object abstraction first.

So, I started creating some Python classes that could wrap Python objects, storing and retrieving their data in globals, i.e., serializing and deserializing Python objects in IRIS globals.

How does it work?

Like ObjectScript%Dispatc

1
1 2371