def get_iris_object(): # Create connection to InterSystems IRIS connection = irisnative.createConnection('iris', 51773, 'IRISAPP', '_SYSTEM', 'SYS') # Create an iris object return irisnative.createIris(connection)
def run(): # Retrieve connection information from configuration file connection_detail = get_connection_info("connection.config") ip = connection_detail["ip"] port = int(connection_detail["port"]) namespace = connection_detail["namespace"] username = connection_detail["username"] password = connection_detail["password"] # Create connection to InterSystems IRIS connection = irisnative.createConnection(ip, port, namespace, username, password) print("Connected to InterSystems IRIS") # Create an iris object iris_native = irisnative.createIris(connection) # Starting interactive prompt while True: print("1. Test") print("2. Store stock data") print("3. View stock data") print("4. Generate Trades") print("5. Call routines") print("6. Quit") selection = int(input("What would you like to do? ")) if selection == 6: break elif selection not in range(1, 7): print("Invalid option. Try again!") continue execute_selection(selection, iris_native)
def __init__(self, *global_array, **otherargs): self.id = ".".join(global_array) self.obj_nx = otherargs["obj_nx"] if "subscripts_filter" in otherargs: self.subscripts_filter = otherargs["subscripts_filter"] else: self.subscripts_filter = None if "hover_dict" in otherargs: self.hover_dict = otherargs["hover_dict"] else: self.hover_dict = {} if "max_depth" in otherargs: self.max_depth = otherargs["max_depth"] else: self.max_depth = -1 if "depth" in otherargs: self.depth = otherargs["depth"] else: self.depth = 0 self.global_array = global_array self.has_value = False self.subscripts = {} self.value = None self.isDefined = 0 self.is_leaf = True if "iris_connection" in otherargs: self.iris_connection = otherargs["iris_connection"] self.iris_native = irisnative.createIris(self.iris_connection) self.fill() return
def __init__(self, **kwargs): super().__init__(**kwargs) conn = irisnative.createConnection(self.host, self.port, self.namespace, self.user, self.password) self.iris = irisnative.createIris(conn)
def run(): # Get connections for PyODBC and the Native API pyodbc_connection, nativeapi_connection = connect_to_iris() # Populate and retrieve data using PyODBC populate_airports(pyodbc_connection) get_airports(pyodbc_connection) # Create an IRIS native object iris_native = irisnative.createIris(nativeapi_connection)
def get_iris_native(self): #todo: understand the behavior of connection object and implement the correct way if not self.iris_connection: self.iris_connection = irisnative.createConnection( self.iris_config["host"], self.iris_config["port"], self.iris_config["namespace"], self.iris_config["username"], self.iris_config["password"]) print("Connected to InterSystems IRIS") # Create an iris object self.iris_native = irisnative.createIris(self.iris_connection) return self.iris_native
def connect_database(): connection_info = get_connnection_info(CONFIG_FILE) ip = connection_info['ip'] port = int(connection_info['port']) namespace = connection_info['namespace'] username = connection_info['username'] password = connection_info['password'] connection = irisnative.createConnection(ip, port, namespace, username, password) print("Connected to server") return irisnative.createIris(connection)
def getIris(): global __IRIS_CONN, __IRIS if "__IRIS" in globals(): return __IRIS __IRIS_CONN = irisnative.createConnection(config.IRIS_IP, config.IRIS_PORT, config.IRIS_NAMESPACE, config.IRIS_USER, config.IRIS_PASSWORD) __IRIS = irisnative.createIris(__IRIS_CONN) atexit.register(__IRIS_CONN.close) return __IRIS
def __init__(self, *global_array, **otherargs): if "subscripts_filter" in otherargs: self.subscripts_filter = otherargs["subscripts_filter"] else: self.subscripts_filter = None self.global_array = global_array self.has_value = False self.subscripts = {} self.value = None self.isDefined = 0 if "iris_connection" in otherargs: self.iris_connection = otherargs["iris_connection"] self.iris_native = irisnative.createIris(self.iris_connection) self.fill() return
def demoSkinnyJwt(verticalType, classId, objectId): # Modify connection info based on your environment ip = "trak.australiasoutheast.cloudapp.azure.com" port = 1972 namespace = "PASS" username = "******" password = "******" # create database connection and IRIS instance connection = irisnative.createConnection(ip, port, namespace, username, password) dbnative = irisnative.createIris(connection) print("Generates a signed skinny JWT.") Globalname = dbnative.get("name") Globalmrn = dbnative.get("mrn") Globalemail = dbnative.get("email") Globaldate = dbnative.get("date") Globaldoctor = dbnative.get("doctor") Globalhospital = dbnative.get("hospital") Globalhospitalphone = dbnative.get("hospitalphone") Globalhospitaladdress = dbnative.get("hospitaladdress") Globallocation = dbnative.get("location") Globalservice = dbnative.get("service") skinnyJwt = services.makeSkinnyJwt(verticalType, classId, objectId, Globalname, Globalmrn, Globaldate, Globaldoctor, Globalhospital, Globalhospitalphone, Globalhospitaladdress, Globallocation, Globalservice) if skinnyJwt is not None: print('This is an "skinny" jwt:\n%s\n' % (skinnyJwt.decode('UTF-8'))) print( 'you can decode it with a tool to see the unsigned JWT representation:\n%s\n' % ('https://jwt.io')) print("[1. Setting and getting a global]") dbnative.set(SAVE_LINK + skinnyJwt.decode('UTF-8'), "PassLink") Globallink = dbnative.get("PassLink") print("The value of testglobal is ", Globallink) return
def run(): # Credentials to connect to InterSystems IRIS database ip = "localhost" port = 51773 namespace = "USER" username = "******" password = "******" # Make connection to InterSystems IRIS database connection = irisnative.createConnection(ip, port, namespace, username, password) print("Hello World! You have successfully connected to InterSystems IRIS.") # Create an InterSystems IRIS native object iris_native = irisnative.createIris(connection) # Store data natively into a global using the InterSystems IRIS native object iris_native.set(8888, "^testglobal", "1") global_value = iris_native.get("^testglobal", "1") print("The value of ^testglobal(1) is {}".format(global_value))
import irisnative # Modify connection info based on your environment ip = "iris" port = 51773 namespace = "USER" username = "******" password = "******" # create database connection and IRIS instance connection = irisnative.createConnection(ip, port, namespace, username, password) dbnative = irisnative.createIris(connection) print("[1. Setting and getting a global]") # setting and getting a global # ObjectScript equivalent: set ^testglobal("1") = 8888 dbnative.set(8881, "testglobal", "1") dbnative.set(8821, "testglobal", "2", "21") dbnative.set(8822, "testglobal", "2", "22") dbnative.set(8831, "testglobal", "3", "31") dbnative.set(8832, "testglobal", "3", "32") dbnative.set(8833, "testglobal", "3", "33") # ObjectScript equivalent: set globalValue = $get(^testglobal("1")) globalValue = dbnative.get("testglobal", "1") print("The value of testglobal is ", globalValue) print() print("[2 Iterating over a global]")
def __init__(self, iris_config): self.iris_connection = None self.get_iris_connection(iris_config) self.iris_native = irisnative.createIris(self.iris_connection) return
import getpass import irisnative user = input("IRIS user: "******"IRIS password: "******"127.0.0.1", 51773, "USER", user, password) iris = irisnative.createIris(conn) stop_id = None stop_name = "Silver Ave & Holyoke St" stop_id = iris.get("stopnames", stop_name) if stop_id is None: print("Stop not found.") import sys sys.exit() all_stop_times = set() trips = iris.iterator("stoptimes", stop_id).subscripts() for trip in trips: all_stop_times.update(iris.iterator("stoptimes", stop_id, trip).values()) for stop_time in sorted(all_stop_times): print(stop_time) conn.close()