User bio
404 bio not found
Member since May 7, 2020
Posts:
Mark has not published any posts yet.
Replies:
Well, it's been several years since this was asked, but I also needed the answer, 
and I found a way to create a database using Python.  
I verified that the new database has been created in the SMP.  
I didn't set the directory, but it put the new database in /data/iris/sys/mgr/, 
where `iris` is my instance name. 
The key step to my progress was to get the IRISReference and pass it, 
even though it is empty.

presuming you already have made the connection...
irispy = iris.createIRIS(conn)

Name = "ABC"
db_exists = irispy.classMethodValue('Config.Databases', 'Exists', Name)
if not db_exists:
   ref_object = iris.IRISReference(None);
   status_db = irispy.classMethodValue('Config.Databases', 'Create', Name, ref_object)
   if status_db != 1:
      print(f"Database create failed: {status_db}")

Here's how I was able to use LOAD DATA.  First I ran into the issue of commas one field, in otherwise csv data.
So, I edited the data file with vi and changed all the delimiters to the '|' symbol using this vi command. :1,$ s/","/"|"/g
Then using SQL for the create table,
CREATE TABLE scotch_reviews ( name VARCHAR(255),
            category VARCHAR(255),
            review_point INT,
            price DOUBLE,
            description VARCHAR(2000),
            description_vector VECTOR(DOUBLE, 384))
Then using LOAD DATA:
LOAD BULK DATA FROM FILE 'scotch_reviews.tbl'
    INTO scotch_reviews (name, category, review_point, price, description)
    USING '{ "from": {"file": {"columnseparator":"|"} } }'
And it worked.

Certifications & Credly badges:
Mark has no Certifications & Credly badges yet.
Global Masters badges:
Mark has no Global Masters badges yet.
Followers:
Mark has no followers yet.
Following:
Mark has not followed anybody yet.