Evgeny Shvarov · Jun 3, 2019 go to post

Stores data on disk? Meaning, that if we create these persistent classes, the data is stored twice? Once in the global node and in some other format as defined (or not defined by the class)?  

ANY data in Caché and IRIS is stored in global and it's not stored twice, everytime in a global, which is in the storage strategy of the persistent class.

Any SQL table in Caché and IRIS has the related persistent class in the metadata.

But just to reiterate, how does the DDL interpret a read definition into a write definition? The data stored in the global node and the definition do line up exactly (in our case, almost not at all).

Could you elaborate, please?

Just in case: you can deal with Caché and IRIS as with any relational DB: use DDL, SQL via ODBC/JDBC.

And yes, every time you call

CREATE TABLE A 

the new persistent class A is being created on the backend to store data in ^AD global.

Evgeny Shvarov · Jun 3, 2019 go to post

It's all about multi-model nature of IRIS and Caché.

Everything in Caché and InterSystems IRIS is being stored in globals - key-value sparse stored arrays.

Every persistent class (a class which stores data on disk) has the map of how the data should be stored in a particular global (globals).

ObjectScript Class definition provides the API of how the data will be stored and read from a global (globals) via Object Script or SQL access.

You can specify standard or custom storage strategy for a class. 

The persistent 'SomeClass' class with standard storage strategy will provide the API to store data in ^SomeClassD data for data itself and ^SomeClassI global for indexes.

You can see the storage strategy of a class in the source code of a persistent class immediately after successful compilation - it will be visible in a related XML block at the bottom of the class.

In your case you have a custom storage strategy which could be everything. Check @Brendan Bannon's series on that which could be really helpful for you.

As @Eduard Lebedyuk mentioned, if you delete the class as source code (e.g. via Management Portal)  it will not delete the data itself.

But! As @Robert Cemper mentioned if you delete it via SQL API with DROP statement it will delete data in a global too (because we suppose the data to be deleted if we DROP a table, right?).

HTH

Evgeny Shvarov · Jun 1, 2019 go to post

Dmitry!

Thanks for your great work! And take my first donut of 1,000 rubles! :) Looking for new features ;)

Evgeny Shvarov · May 23, 2019 go to post

Nice!

Just tried this with docker container on my local machine.

And got 1 million insertions(1,000,000) in 1,45 sec on my mac pro. Cool!

Evgeny Shvarov · May 6, 2019 go to post

Hi @Anton Umnikov ! Thanks for raising this topic. 

The question of the most acceptable folder structure widely discussed already on community. 

As for Atelier, - why do you care where it puts the code? I believe you can maintain your code in a folder structure you like and let Atelier compile it and bring back in a place it took it, right?

Evgeny Shvarov · May 2, 2019 go to post

Guys, thanks for a lot of options! It looks like it is a relevant question ;)

Personally I feel that 3 parameters for a method are OK, but 4 is too much. But how much is for an average developer? Is there is a consensus about it?

If I know, that method will accept a lot of settings and not all of them are mandatory, I like the .args approach, which @Robert Cemper mentioned and which, e.g. is introduced in e.g. in Database, Namespace and Web App management functions. E.g.:

set props("NameSpace")="Namespace"

set props("Enabled")=1

set props("DeepSeeEnabled")=1

Do ##class(Security.Applications).Create("AppName", .props)

It's readable and you don't count commas.

Also I'm curious if we can setup and pass a JSON that easily too? Would be great.

Evgeny Shvarov · May 2, 2019 go to post

Yes, Dmitry.  Args... feature is neat, but you don't know what each parameter does so it's easy to miss the thing when you call the method, because the Args(index) should be a number, but not a meaningful parameter.

Evgeny Shvarov · May 2, 2019 go to post

Hi Duncan!

As mentioned above the video is a sort of "work through" for this article. Could you be more specific what doesn't work?

BTW, just Yesterday I recorded another one which shows how to start a totally new app with Github, IRIS on docker and VSCode. Hope it will answer some of your questions.

Evgeny Shvarov · May 2, 2019 go to post

Yes. It's easy if you are in IDE.

But often you need to call this useful function from terminal...

Evgeny Shvarov · Apr 28, 2019 go to post

Hi Stella!

If you have the id of a child object and know how to form expressions and how to call %cube methods - what prevents you from opening the object of child by childId and get return its properties to form levels of dimension, properties of level, etc?

Evgeny Shvarov · Apr 25, 2019 go to post

What a problem are you trying to solve? Is it to sort long strings? or ti find duplicates in long strings?

Evgeny Shvarov · Apr 22, 2019 go to post

Thanks, Ed!

I placed iscpython.so file into the repo floder and this helped - docker-compose build worked smoothly and container started.

So I managed to build this with  IRIS Community Edition, though you need to go directly to PYTHON namespace to make it work - class mapping is not available on IRIS CE unfortunately.

Anyway, python in container is callable from IRIS:

Namespace: 
You're in namespace USER
Default directory is /usr/irissys/mgr/user/
USER>zn "PYTHON"

PYTHON>set sc = ##class(isc.py.Callout).Setup()

PYTHON>set sc = ##class(isc.py.Main).SimpleString("x='Hello from Python'", "x", , .x)

PYTHON>write x
Hello from Python
PYTHON>set sc = ##class(isc.py.Callout).Finalize()

PYTHON>set sc = ##class(isc.py.Callout).Unload()

PYTHON>
Evgeny Shvarov · Apr 21, 2019 go to post

Another thing happened:

Step 16/20 : COPY ./isc/ $SRC_DIR/isc
 ---> c989207755ea
Step 17/20 : COPY ./rtn/ $SRC_DIR/rtn
 ---> 69e29a972e05
Step 18/20 : COPY iscpython.so $ISC_PACKAGE_INSTALLDIR/bin/
ERROR: Service 'iris' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder989962722/iscpython.so: no such file or directory
Evgeny Shvarov · Apr 21, 2019 go to post

Tried to do a docker-compose locally and got failed. Here is the part of trace:

+ python get-pip.py --disable-pip-version-check --no-cache-dir pip==19.0.3
Collecting pip==19.0.3
  Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/c8/b0/cc6b7ba28d5fb790cf0d5946df849233e32b8872b6baca10c9e002ff5b41/setuptools-41.0.0-py2.py3-none-any.whl (575kB)
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/96/ba/a4702cbb6a3a485239fbe9525443446203f00771af9ac000fa3ef2788201/wheel-0.33.1-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-19.0.3 setuptools-41.0.0 wheel-0.33.1
+ pip --version
pip 19.0.3 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
+ find /usr/local -depth ( ( -type d -a ( -name test -o -name tests ) ) -o ( -type f -a ( -name *.pyc -o -name *.pyo ) ) ) -exec rm -rf {} +
+ rm -f get-pip.py
Removing intermediate container 21587d33a883
 ---> 5be4246c2aad
Step 13/19 : RUN pip install pandas matplotlib seaborn numpy dill
 ---> Running in ade32bf9dd2c
Collecting pandas
  Downloading https://files.pythonhosted.org/packages/19/74/e50234bc82c553fecdbd566d8650801e3fe2d6d8c8d940638e3d8a7c5522/pandas-0.24.2-cp36-cp36m-manylinux1_x86_64.whl (10.1MB)
Collecting matplotlib
  Downloading https://files.pythonhosted.org/packages/e9/69/f5e05f578585ed9935247be3788b374f90701296a70c8871bcd6d21edb00/matplotlib-3.0.3-cp36-cp36m-manylinux1_x86_64.whl (13.0MB)
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 360, in _error_catcher
    yield
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 442, in read
    data = self._fp.read(amt)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "/usr/local/lib/python3.6/http/client.py", line 449, in read
    n = self.readinto(b)
  File "/usr/local/lib/python3.6/http/client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "/usr/local/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.6/ssl.py", line 1012, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.6/ssl.py", line 874, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 179, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 315, in run
    resolver.resolve(requirement_set)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 131, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 294, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
    self.require_hashes
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 334, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 878, in unpack_url
    progress_bar=progress_bar
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 702, in unpack_http_url
    progress_bar)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 946, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 639, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/utils/hashes.py", line 62, in check_against_chunks
    for chunk in chunks:
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 607, in written_chunks
    for chunk in chunks:
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/utils/ui.py", line 159, in iter
    for x in it:
  File "/usr/local/lib/python3.6/site-packages/pip/_internal/download.py", line 596, in resp_read
    decode_content=False):
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 494, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 459, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 365, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
ERROR: Service 'iris' failed to build: The command '/bin/sh -c pip install pandas matplotlib seaborn numpy dill' returned a non-zero code: 2
Evgeny Shvarov · Apr 18, 2019 go to post

And the settings of VSCode which does the "instant-coding" effect are:

{
    "objectscript.conn.version": 3,
    "objectscript.conn.ns": "OSCRIPT",
    "objectscript.conn.port": 52773,
    "objectscript.conn.active": true
}

The file.