Skip to main content

Hi,

This is Keerthana. I'm Senior Software Engineer in TP project at Mitra Innovations.

Currently, we are attempting to establish a connection between U2 Python and native Python.

Our concern is that what we have done first is used UOPY module to access the subroutine and data file in BP source in XDEMO account using session. But U2 python does not require a session because the u2py module is included in the XDEMO account. But if we want to connect U2 python and native python there must be a configuration or session right? Can we connect this without using a session? Or are there other ways?

We checked the .pyconfig file in the UV and tried changing the path to PYHOME and PYLIB there. But we are unable to connect. So Now we are thinking for the connection purpose we can use the any middle ware, Like MVIS. I'm not sure our thought is correct or not. So please anyone have any idea let me know or do you have any refrence please share with me

------------------------

Thank you
Keerthana.R
Senior Software Engineer

Hi,

This is Keerthana. I'm Senior Software Engineer in TP project at Mitra Innovations.

Currently, we are attempting to establish a connection between U2 Python and native Python.

Our concern is that what we have done first is used UOPY module to access the subroutine and data file in BP source in XDEMO account using session. But U2 python does not require a session because the u2py module is included in the XDEMO account. But if we want to connect U2 python and native python there must be a configuration or session right? Can we connect this without using a session? Or are there other ways?

We checked the .pyconfig file in the UV and tried changing the path to PYHOME and PYLIB there. But we are unable to connect. So Now we are thinking for the connection purpose we can use the any middle ware, Like MVIS. I'm not sure our thought is correct or not. So please anyone have any idea let me know or do you have any refrence please share with me

------------------------

Thank you
Keerthana.R
Senior Software Engineer

Keerthana,

Could you re-phrase what you are trying to achieve please? UOPY and U2 Python are separate features and I am not clear on the requirement.

  • UOPY allows a Python client application to create a session connection to the database and perform various database functions - such as access a file, run a  command or execute a program while exchanging data. Python is only used on the client side, and while a program EXECUTEd on the server can itself call U2 Python, this is quite separate and unrelated to the method of connection being UOPY. The session and database license slot are taken at the point of UOPY connection and released when the UOPY connection / session is closed. - though see 'connection pooling' for how individual connections and sessions can be serially shared.
  • If invoked in a U2 database session/shell then U2 Python allows invocation of Python code and data interchange from BASIC in any account (as configured) using the version of Python as supplied with the database. The datbase license/session is taken when the UniVerse or UniData database is invoked - Python itself requires enabling in the database license but does not in itself require session-based licenses as it is a global feature that just requires enabling.
  • If Python is used at the O.S. level then U2 Python allows Python code on the server to invoke U2 database functions locally - this is similar to the client-side functionality provided by UOPY. Sessions and license slots are taken when a U2 database connection is made and released when the connection is closed and the U2 database session terminates.

It should be noted that not all Python versions are interchangeable due to functional changes. For example, 2.7 and 3.4. Similarly, not all Python packages are compatible with all Python versions - the Python Package Index can provide specific verion compatibility here. As a minimum I recommend using the version provided by Rocket as a minimum version requirement. 

Please expand upon the specific requirement, why a different version that that provided with the database is needed, and how iot is intended to be used and I'll see if I can assist. If the requirement is to use a legacy Python module which is not compatible with the current version I suspect this would not be achievable except by executing a raw command line  Python command at the O.S, level from a database shell - just as you might execute any DOS or UNIX command - and exchanging data either in a  text file or on the command line and CAPTURing the reqults.

Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------


Keerthana,

Could you re-phrase what you are trying to achieve please? UOPY and U2 Python are separate features and I am not clear on the requirement.

  • UOPY allows a Python client application to create a session connection to the database and perform various database functions - such as access a file, run a  command or execute a program while exchanging data. Python is only used on the client side, and while a program EXECUTEd on the server can itself call U2 Python, this is quite separate and unrelated to the method of connection being UOPY. The session and database license slot are taken at the point of UOPY connection and released when the UOPY connection / session is closed. - though see 'connection pooling' for how individual connections and sessions can be serially shared.
  • If invoked in a U2 database session/shell then U2 Python allows invocation of Python code and data interchange from BASIC in any account (as configured) using the version of Python as supplied with the database. The datbase license/session is taken when the UniVerse or UniData database is invoked - Python itself requires enabling in the database license but does not in itself require session-based licenses as it is a global feature that just requires enabling.
  • If Python is used at the O.S. level then U2 Python allows Python code on the server to invoke U2 database functions locally - this is similar to the client-side functionality provided by UOPY. Sessions and license slots are taken when a U2 database connection is made and released when the connection is closed and the U2 database session terminates.

It should be noted that not all Python versions are interchangeable due to functional changes. For example, 2.7 and 3.4. Similarly, not all Python packages are compatible with all Python versions - the Python Package Index can provide specific verion compatibility here. As a minimum I recommend using the version provided by Rocket as a minimum version requirement. 

Please expand upon the specific requirement, why a different version that that provided with the database is needed, and how iot is intended to be used and I'll see if I can assist. If the requirement is to use a legacy Python module which is not compatible with the current version I suspect this would not be achievable except by executing a raw command line  Python command at the O.S, level from a database shell - just as you might execute any DOS or UNIX command - and exchanging data either in a  text file or on the command line and CAPTURing the reqults.

Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------

Hi John,

Thank you so much for sharing this information.

Our requirement is that we have been doing 2 things lately.

  1. We have written REST api in native python (Dijango) using UOPY module to fetch data from a data file in XDEMO account and create new data. But to connect to the REST APIs and the database, we had created and closed a session in each API. But this is not a proper way. So we are seeing if we can configure the session in one place and call the session only once.
  2. The second issue is that we have written a program that does POST /GET functionality of data from a data file in the XDEMO account with U2 Python. But U2 python does not require a session because the u2py module is included in the XDEMO account. So now we are trying to integrate this program with native python (Dijango) and write REST apis without using session. But we couldn't. 



------------------------------
Keerthana Raveendran
Senior Software Engineer
Mitra Innovation


Hi,

This is Keerthana. I'm Senior Software Engineer in TP project at Mitra Innovations.

Currently, we are attempting to establish a connection between U2 Python and native Python.

Our concern is that what we have done first is used UOPY module to access the subroutine and data file in BP source in XDEMO account using session. But U2 python does not require a session because the u2py module is included in the XDEMO account. But if we want to connect U2 python and native python there must be a configuration or session right? Can we connect this without using a session? Or are there other ways?

We checked the .pyconfig file in the UV and tried changing the path to PYHOME and PYLIB there. But we are unable to connect. So Now we are thinking for the connection purpose we can use the any middle ware, Like MVIS. I'm not sure our thought is correct or not. So please anyone have any idea let me know or do you have any refrence please share with me

------------------------

Thank you
Keerthana.R
Senior Software Engineer

Hi @Keerthana Raveendran 

The best approach would be to raise a support call with Rocket to discuss your issues.

Thanks,



------------------------------
Jonathan Smith
UniData ATS
Rocket Support
------------------------------

Hi John,

Thank you so much for sharing this information.

Our requirement is that we have been doing 2 things lately.

  1. We have written REST api in native python (Dijango) using UOPY module to fetch data from a data file in XDEMO account and create new data. But to connect to the REST APIs and the database, we had created and closed a session in each API. But this is not a proper way. So we are seeing if we can configure the session in one place and call the session only once.
  2. The second issue is that we have written a program that does POST /GET functionality of data from a data file in the XDEMO account with U2 Python. But U2 python does not require a session because the u2py module is included in the XDEMO account. So now we are trying to integrate this program with native python (Dijango) and write REST apis without using session. But we couldn't. 



------------------------------
Keerthana Raveendran
Senior Software Engineer
Mitra Innovation

Keerthana,

It sounds to me that you don't want each RESTful call to login and logout each time. You want to stay logged in as if you were running native Python from within Universe. Your best solution would be to purchase Connection Pooling from Rocket. You can read about it in the uopy docs. I don't have pricing at hand, but your Rocket representative can tell you.



------------------------------
Phillip Potter
V.P. R&D
Data Management Associates Inc DMA
Cincinnati OH US
------------------------------