« How do I efficiently retrieve the first n rows of a query result? | Main | How can I set a trigger on a kdb table? »

How can I have kdb automatically load q code at startup in every session?

Every time you start q, it looks for a file called q.q (in $QHOME, if defined, or current working directory otherwise). If q finds q.q, it will execute it before presenting a prompt or calling any script you provided on the command line.

If you want to call the file something else, or keep it separate from your q installation, you can set the environment variable QINIT to the path to your initialization file.

It is also possible to add k code to q.k (which will be executed before q.q), although we've never needed to.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Textile formatting is allowed.