How to Create new table(models) whenever a new record is created in Django without interrupt a running server

by Arvindh   Last Updated January 14, 2018 12:26 PM

How to create separate table for each record in models (table with same fields for all models), It should happens whenever the new record in models in aa running server without interruption of server

--------------------------------------------------------------------------------
|  Id  |       Station Name     |        GPS Location         |    Address
--------------------------------------------------------------------------------

|  1   | Station 1              |   35.211898, -101.969547    |  Some where  |

|  2   | Station 2              |   43.793428, -102.658402    |  Some where  |

|  ... |..............          |  ...................        |  ......      |

|  ... |..............          |  ...................        |  ......      |

|  ... |..............          |  ...................        |  ......      |

|  n   |Station n               |  xx.xxxxxx,  xx.xxxxx       |  xxxxxx      |

--------------------------------------------------------------------------------

For these each entries I need separate table(Models) like below mentioned should create automatically , whenever a new record is added All Columns headings(Fields) are same in all the table(models) which are create for the record

**TABLE NAME**: Station 1
-------------------------------------------------------------------------------
| TimeStamp              | Temperature | Humidity |...|...|...| 40th Column | 
--------------------------------------------------------------------------------

|14-Jan-18 11:30:12      |     20.13 C |    15%   |...|...|...|    xxxxxx   |

|14-Jan-18 11:30:13      |     20.16 C |    15%   |...|...|...|    xxxxxx   |

|14-Jan-18 11:30:14      |     20.11 C |    15%   |...|...|...|    xxxxxx   |

|14-Jan-18 11:30:15      |     20.18 C |    15%   |...|...|...|    xxxxxx   |

.
.
.

|20-Dec-18 16:14:30      |     30.74 C|     55%  |...|...|...|    xxxxxx    |


**TABLE NAME**: Station 2
-------------------------------------------------------------------------------
| TimeStamp              | Temperature | Humidity |...|...|...| 40th Column | 
--------------------------------------------------------------------------------

|20-Jan-18 16:01:56      |     40.13 C |    35%   |...|...|...|    xxxxxx   |

|20-Jan-18 16:01:57      |     40.16 C |    35%   |...|...|...|    xxxxxx   |

|20-Jan-18 16:01:58      |     40.11 C |    35%   |...|...|...|    xxxxxx   |

|20-Jan-18 16:01:59      |     40.18 C |    35%   |...|...|...|    xxxxxx   |

.
.
.

|20-Dec-18 16:14:30      |     20.74 C|     10%  |...|...|...|    xxxxxx    |



**TABLE NAME**: Station n
-------------------------------------------------------------------------------
| TimeStamp              | Temperature | Humidity |...|...|...| 40th Column | 
--------------------------------------------------------------------------------

|12-Jan-18 21:54:01      |     30.13 C |    45%   |...|...|...|    xxxxxx   |

|12-Jan-18 21:54:02      |     30.16 C |    45%   |...|...|...|    xxxxxx   |

|12-Jan-18 21:54:03      |     30.11 C |    45%   |...|...|...|    xxxxxx   |

|12-Jan-18 21:54:04      |     30.18 C |    45%   |...|...|...|    xxxxxx   |

.
.
.

|26-Dec-18 23:45:30      |     10.40 C|     10%  |...|...|...|    xxxxxx    |

Now i am logging all station data in to one TABLE. Now there is only 10 stations

Each station will log data for every 1 second

In two to three months it will increase upto 1000 stations.

So 1000's of process will access the single table in the Database for every second I don't know how much this will work efficiently when scaling to 1000 station.

If user needs to see one year historical data, Then need to Query from the same table, So I am afraid how can that table can handle every things.

How long it will take to a Query 1 year of data from database.

So this idea and question arise for me

Currently I am using SQLite database.



Related Questions


Django response nested models

Updated April 10, 2017 11:26 AM

Django autocomplete light queryset filter

Updated June 07, 2017 21:26 PM

Django Integrity Error using invite app

Updated September 10, 2017 11:26 AM


Django file sharing between users

Updated October 05, 2017 08:26 AM