Have several 128 elements lists, need to obtain distance between them
I can not save them as a list of floats, since i get: "can't adapt type numpyndarray"


Quick google search shows numpyndarray as being SciPy's "N-dimensional array". This can hold what PostgreSQL calls a cube and vise-versa.

You assume that there is a translation layer that takes numpyndarray and converts the types to a cube for you. There likely isn't. You could provide such a layer, or extend your PostgreSQL connector/driver to provide that layer (see this for information on psycopg), but shy of that you'll have to go by way of text.

That means you'll be calling cube() or providing a text string and a cast to cube.

SELECT '(0,1,2,3,4,5)'::cube;
SELECT CAST ( '(0,1,2,3,4,5)' AS cube );


Your job is to convert numpyndarray to a textual representation like the above, and then to convert it back again.

Cubes can also be constructed as float[] which you may find easier if your DB layer supports that,

SELECT cube(ARRAY[0,1,2,3,4,5]::float[]); ## Array-constructor for float[]
SELECT cube('{1,2,3,4,5}'::float[]);      ## Text-constructor for float[]