sql server database to kdb+ database

364 views
Skip to first unread message

Michael He

unread,
Jul 5, 2018, 1:49:45 AM7/5/18
to Kdb+ Personal Developers
Hi everyone,

I'm new to kdb+. What I have now is huge amount of intraday equity data stored in sql server database, and I would like to store them in kdb+ dababase format. I learned that the best way to do it is through partitioned tables with date or trading code as my partition domain.

My question is that is it really necessary to convert from sql server format to kdb+ format? And if so, is it simple like "query from sql server and save the fields into different columns" or do I get something wrong?

Thanks in advance,

Michael

Flying

unread,
Jul 5, 2018, 3:05:13 AM7/5/18
to Kdb+ Personal Developers
Looks like you'll have some study to catch up first. You've got to understand the basic conceptual differences between a traditional RDBMS and kdb+ in order to effectively work out the work flow you need.

The short answer is: From kdb+, you can indeed run sql queries on you existing data in order to extract data into kdb+ for further processing. But in order to make full use of kdb+'s power, you'd have to make use of a database in kdb+'s native format.

Recommended starters:

Michael He

unread,
Jul 6, 2018, 2:02:29 AM7/6/18
to Kdb+ Personal Developers
Thanks Flying.

The demo demonstrating how to import large CSV file into q proved quite helpful.

Previously I was trying to connect to sql server from q throught ODBC and hoping that I could directly create a database in kdb+'s native format with the data queried. It seems to me that loading CSV is an alternative way to fulfill what I initially intended, right?

-Michael

在 2018年7月5日星期四 UTC+8下午3:05:13,Flying写道:

Jack Andrews

unread,
Jul 7, 2018, 3:15:38 PM7/7/18
to Kdb+ Personal Developers
>csv and odbc

csv loading is an alternative to odbc.  

--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbplus+unsubscribe@googlegroups.com.
To post to this group, send email to personal-kdbplus@googlegroups.com.
Visit this group at https://groups.google.com/group/personal-kdbplus.
For more options, visit https://groups.google.com/d/optout.

Michael He

unread,
Jul 15, 2018, 11:43:42 AM7/15/18
to Kdb+ Personal Developers
Thanks effbiae. After a few days of catching up I've successfully load data through odbc and save them as partitioned table.

Yet there comes another problem. The full table I'm working with in SQL Server is too large to load into q process, which makes me wonder if there exists some way, like a while...do... loop so I can get part of the table from SQL Server at one time, and next I can use upsert to recover the full table part by part. Previously I was able to realize this in MATLAB while handling smaller data set, and I guess kdb+ could possibly have similar function.


在 2018年7月8日星期日 UTC+8上午3:15:38,effbiae写道:
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbpl...@googlegroups.com.
To post to this group, send email to personal...@googlegroups.com.

Jack Andrews

unread,
Jul 16, 2018, 5:55:23 PM7/16/18
to Kdb+ Personal Developers
To solve the size problem, why not use a where clause like
  where date>=a and date<b
in your sql for a sequence of dates a,b,...

hzad...@gmail.com

unread,
Jul 21, 2018, 2:47:06 AM7/21/18
to Kdb+ Personal Developers
There's a video maybe helpful.

Jack Andrews

unread,
Jul 22, 2018, 5:52:33 PM7/22/18
to Kdb+ Personal Developers
this video is about connecting to kdb 
but the need is to connect to another db from kdb

--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbplus+unsubscribe@googlegroups.com.
To post to this group, send email to personal-kdbplus@googlegroups.com.

Michael He

unread,
Aug 3, 2018, 2:17:33 AM8/3/18
to personal...@googlegroups.com
Thanks Jack.

I've solved the problem using a "where" clause like you mentioned. At first I was thinking about precise control so that my function wouldn't explode when data in a particular range suddenly become too large. I knew "where" could be a solution but wondered if there was a better one.

Michael

To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbplus+unsubscribe@googlegroups.com.
To post to this group, send email to personal-kdbplus@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/personal-kdbplus/lJGry_5WbuA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to personal-kdbplus+unsubscribe@googlegroups.com.
To post to this group, send email to personal-kdbplus@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages