Q: How to defer SqliteQueueDatabase?
The tables *are* created, but since this multi-threaded, their creation may be deferred for a moment.

For example:

```python

db = SqliteQueueDatabase(None)

class Reg(Model):
    key = TextField()
    value = IntegerField()
    class Meta:
        database = db

db.init('foo.db')
db.start()
db.connect()
db.create_tables([Reg])

print(db.database)
print(db.get_tables())
```

The above code may print:

```
foo.db
[]
```

Which indicates that the tables aren't created immediately (though they *are* created as soon as the running thread switches). It seems you have forgotten, maybe, that python is single-threaded?

To force a context-switch, you can introduce a tiny sleep(), which will switch contexts and then show you the expected output:

```python

print(db.database)
import time; time.sleep(0.01)
print(db.get_tables())
```

This prints the expected:

```
foo.db
['reg']
``` I think it does not work because the parent's thread is a QThread.
I also tried those snippets (just before the `time.sleep()` trick) without luck:

```python
from PyQt5.QtCore import QCoreApplication
QCoreApplication.processEvents()
```
```python
from PyQt5.QtCore import QTimer
timer = QTimer()
timer.timeout.connect(lambda: None)
timer.start(100)
```

Do you know some workaround? how other resolve this question?

import time; time.sleep(0.01)



 this is my code:

it is ok, `sleep()`  is primary code.

```python
# -*- coding: utf-8 -*-
import time

from peewee import TextField, AutoField, Model
from playhouse.sqliteq import SqliteQueueDatabase

db = SqliteQueueDatabase(database='database.db')


class UserModel(Model):
    id = AutoField()
    name = TextField()

    class Meta:
        database = db

        table_name = 'tb_user'


# cerate
db.create_tables([UserModel])

# wait
time.sleep(0.01)

# query
row = UserModel.select('id').where(
    UserModel.id, '=', 1
).get_or_none()

print(row)
# None

``` You could try using a barrier or an event. See https://docs.python.org/3/library/threading.html
Hello,

This is a very great module, thanks for that :muscle: 

I am trying to defer `SqliteQueueDatabase` initalization as the database filename is only known at run-time. This is the code:
```python
# models.py
PRAGMAS = (("foreign_keys", 1), ("journal_mode", "wal"), ("synchronous", 3))
DATABASE = SqliteQueueDatabase(None, autostart=False, pragmas=PRAGMAS)

class BaseModel(Model):
    class Meta:
        database = DATABASE
        only_save_dirty = True
```
And elsewhere I set the real database file:
```python
# file.py
db = "my-file.db"
DATABASE.init(db, pragmas=PRAGMAS)  # I am not sure if pragmas is useful?
DATABASE.start()
DATABASE.connect()
DATABASE.create_tables(MODELS)
```

Unfortunately, I cannot manage to make the code works: tables are not created.
Note that the same code (minus `DATABASE.start()`) works like a charm if I use `SqliteDatabase`.

Do you have a clue what I am doing wrong?

Thanks a lot :)