开发者

How to store and query data into Database depending upon its arrival time?

I have unpredictable frequency of Incoming csv data file which I need to store into mysql database. I can get multiple csv file in a day or I can get one csv file in one week.

CSV files contains data that is valid for the day when it was received meaning it contains offers details which are vali开发者_运维问答d for only the day file was send and so my question is that is it possible to store this data into mysql database according to dates of its arrival.

Meaning If I received csv file on 19th December, 2009 and than on 20th December, 2009 than in mysql database can I have some sort of way to partition such that I will have heading 19th December, 2009 and than under it would be all offer data relevant for that day and than will have 20th December, 2009 which will then have all offer details relevant to that day instead of having generic tables and entries as this is the explicitly mentioned in client's requirement that they do not want generic tables and entries.


you could set a column to equal the creation time of the file. (The closest thing on most unix fs would be the ctime. In php filectime()).

If you actually need to create new tables or columns named after the arrival times, your script would need to call create table, or alter table add column, etc with the formatted date string.


In your table, add a column of a DATE type, which you set to the current date when you process the CSV file. (Assuming you process it when it arrives).


If each entry has a timestamp, then why not just include that field as a datetime field in the MySQL database?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜