Retrieves a MemoryTable object representing the specified table. A MemoryTable, upon creation, will immediately load all data from the database table it represents, and keep it in memory. It is reused where possible, just like a DatabaseTable.
A MemoryTable is intended to be used for cases where frequent lookup of data in small tables is necessary, eliminating the SQLite lookup overhead.
Important: The existence of a table is not checked. You need to make sure that the table exists by yourself, if you cannot rely on this!
Important: If your database table is modified by another application or instance, the data in your MemoryTable will be out of sync. In this case, use a regular MemoryTable or .refresh() the data frequently.
- table_name
- The name of the table you wish to work with.
Example: Accessing a database table and keeping it in memory
Code:db = Database("test.db")
table = db.get_memory_table("sample_table")