0

Is there a way to store byte array in to cql database? I tried with blob but it didn't work. The table still have the blob column but I can't load nor store it. Here the code to create table

CREATE TABLE tb (id int PRIMARY KEY, data blob);

The loading code

        public Image convertImgFromByte()
        {
            string query = "SELECT data FROM tb where id = " +id + " ALLOW FILTERING;";
            var results = DataConnection.Ins.session.Execute(query).FirstOrDefault();
            byte[] arr = results.GetValue<byte[]>("picture");
    
            using (var ms = new MemoryStream(arr))
            {
                Image img= Image.FromStream(ms);
                return img;
            }
            return null;
        }

Can anyones give me some suggestion?

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
Adon Lamp
  • 19
  • 5

1 Answers1

0

There are two possibilities

Can you directly access the SQL in CLI and ensure the image exists. or The tag you are referring "picture" could be different as in the byte array you can also lookup with index.

Imran
  • 41
  • 7
  • Well, it seems that cassandra I queried doesn't have the blob column, it possible the table was mis-create – Adon Lamp Jun 11 '22 at 07:11