Inserting into a table loaded from file

I am having an issue when trying to insert into a table that I have loaded from a file. I save my default name space by doing this:
:savedinstance.bin set get .

In another q session i load the file by doing :

. set get :savedinstance.bin 

However, now when i try to a table that exists in that namespace I get a type error. If I redfine the table to a empty table with the same columns etc etc I can insert no problem. Any idea on why this is the case?

It sounds as though you’re inserting into something that isn’t a table when it gets loaded in. What’s the table’s name and meta data? Also what is the result when you run (get[:saved data.bin])[<tablename>]. 

Is the table splayed? You can’t insert data into a splayed table but you could if you redefined it.

Aidan

Can you just post your example and show the issue first hand? What you are describing can’t be replicated…

q)t:(10?10)

q)`t insert 1

,10

q)v:10

q)func:{10+x}

q):ns set get .

`:ns

q)delete t,v,func from `.

`.

q)key`.

`symbol$()

q). set get:ns

`.

q)key`.

tv`func

q)`t insert 11

,11

Sean

this is where it gets weird, if I save the namespace and load the table the same day without a restart I have no issues inserting. However, after a reboot of my machine if i load my namespace I get errors when inserting. For example, I have saved a namespace a few days ago, today I ran another instance with the same code and saved the namespace. If i try to load the namespace i saved a few days ago the insert does not work. The one that I saved today however does work. I tried this:
tick200 insert (“z”$cbarstart),(“z”$tabdatal[0]),(“f”$cbaropen),(“f”$tabdatal[4]),(“f”$cbarhigh),(“f”$cbarlow),(“j”$cbarvolume),(“f”$cbarvwap),(“f”$netchg),(“f”$totchg),(“f”$effratio),(“f”$thatshit),(“f”$diff),(“f”$valuep),(“f”$truncValue),(“f”$fish),(“f”$upmajor),(“f”$downmajor),(“f”$exits),(“f”$exitl),(“f”$pos),(“f”$entryprice)

but it results in a type error

meta tick200 yeilds:

I also verified that the variables are all defined and are the same type as the table columns by executing :

(“z”$cbarstart),(“z”$tabdatal[0]),(“f”$cbaropen),(“f”$tabdatal[4]),(“f”$cbarhigh),(“f”$cbarlow),(“j”$cbarvolume),(“f”$cbarvwap),(“f”$netchg),(“f”$totchg),(“f”$effratio),(“f”$thatshit),(“f”$diff),(“f”$valuep),(“f”$truncValue),(“f”$fish),(“f”$upmajor),(“f”$downmajor),(“f”$exits),(“f”$exitl),(“f”$pos),(“f”$entryprice)

This is totally bizarre completely mind-boggled 

Have you perhaps forgotten a back tick on your insert statement or is that variable defined as a symbol naming another table elsewhere.

Are you loading any splayed or HDB tables before attempting to insert? Is the output of tick200 a table or a file path? Can you paste the output of tick200 when executed directly from a q prompt (or the first few rows at least).

Thanks,
Aidan