I have table

CREATE TABLE nodes (
        name VARCHAR(50) NOT NULL, 
        parent VARCHAR(50), 
        PRIMARY KEY (name), 
        FOREIGN KEY(parent) REFERENCES nodes (name) ON UPDATE cascade
);

I put some data

INSERT INTO nodes (name, parent) VALUES ('n1', NULL);
INSERT INTO nodes (name, parent) VALUES ('n11', 'n1');
INSERT INTO nodes (name, parent) VALUES ('n12', 'n1');
INSERT INTO nodes (name, parent) VALUES ('n13', 'n1');

Let's delete all

DELETE FROM nodes;

Nope, no way.

SQL Error [124] [S1000]: [SQLCODE: <-124>:<FOREIGN KEY constraint failed referential check upon DELETE of row in referenced table>]
[Location: <ServerLoop>]
[%msg: <At least 1 Row exists in table 'SQLUser.nodes' which references key 'NODESPKey2' - Foreign Key Constraint 'NODESFKey3', Field(s) 'parent' failed on referential action of NO ACTION>]

0 7
0 430

I want to connect IRIS system as it has all the database tables. on top of that I am creating a REST API in python. How can I connect to IRIS DB. here is my example code for connection

def connect():

connection_string = "localhost:1972/USER"

username = "_SYSTEM"

password = "SYS"

conn = iris.connect(connection_string, username, password)

after this connection is created but how can I get tables data. Please let me know more about how we can integrate IRIS database into a python REST API.

0 1
0 187

In article

https://community.intersystems.com/print/518106

Traceback (most recent call last):
File "c:\Users\rochesterd\PythonScripts\fhir_stuff\fhir-client-python-main\fhir-client-python-main\src\client.py", line 57, in <module>
patient0 = Patient.parse_obj(patients_resources.search(
AttributeError: 'NoneType' object has no attribute 'serialize'

0 8
0 185

I am sending an httpRequest from ObjectScript to a python server. I am not receiving a response in OS

OS config On the client side

// Create an HTTP request object
Set httpRequest = ##class(%Net.HttpRequest).%New()

// Set the server URL
Set httpRequest.Server = "http://127.0.0.1:8080"

// Set content type to JSON
Set httpRequest.ContentType = "application/json"

0 5
0 138

import os

# Get environment variables
db_host = os.getenv('DB_HOST')
db_port = os.getenv('DB_PORT')
db_namespace = os.getenv('DB_NAMESPACE')
db_username = os.getenv('DB_USERNAME')
db_password = os.getenv('DB_PASSWORD')

# Create a database connection
conn = irisnative.createConnection(db_host, db_port, db_namespace, db_username, db_password)

# Create an IRIS instance from this connection
iris_native = irisnative.createIris(conn)

status = iris_native.classMethodValue('%SYSTEM.OBJ', 'Load', 'Production.cls', 'ck')

0 3
0 133

Using VECTOR_COSINE() in SQL query to perform a text similarity search on existing embeddings in a %VECTOR column.

Code is below.

Commented out sql query returns this error: SQLCODE: -29 Field 'NEW_EMBEDDING_STR' not found in the applicable tables^ SELECT TOP ? maxID , activity , outcome FROMMain .AITest ORDER BY VECTOR_COSINE ( new_embedding_str ,

Sql query as written returns ERROR #5002: ObjectScript error: <PYTHON EXCEPTION> *<class 'OSError'>: isc_stdout_write: PyArg_ParseTuple failed!

0 10
0 83