mirror of
				https://github.com/enpaul/peewee-plus.git
				synced 2025-11-04 01:08:38 +00:00 
			
		
		
		
	Add default sqlite pragma dictionary
This commit is contained in:
		@@ -20,15 +20,25 @@ __authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__all__ = [
 | 
					__all__ = [
 | 
				
			||||||
 | 
					    "calc_batch_size",
 | 
				
			||||||
 | 
					    "EnumField",
 | 
				
			||||||
 | 
					    "JSONField",
 | 
				
			||||||
    "PathField",
 | 
					    "PathField",
 | 
				
			||||||
    "PrecisionFloatField",
 | 
					    "PrecisionFloatField",
 | 
				
			||||||
    "JSONField",
 | 
					    "SQLITE_DEFAULT_PRAGMAS",
 | 
				
			||||||
    "EnumField",
 | 
					 | 
				
			||||||
    "SQLITE_DEFAULT_VARIABLE_LIMIT",
 | 
					    "SQLITE_DEFAULT_VARIABLE_LIMIT",
 | 
				
			||||||
    "calc_batch_size",
 | 
					 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SQLITE_DEFAULT_PRAGMAS: Dict[str, Any] = {
 | 
				
			||||||
 | 
					    "journal_mode": "wal",
 | 
				
			||||||
 | 
					    "cache_size": -1 * 64000,
 | 
				
			||||||
 | 
					    "foreign_keys": 1,
 | 
				
			||||||
 | 
					    "ignore_check_constraints": 0,
 | 
				
			||||||
 | 
					    "synchronous": 0,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SQLITE_DEFAULT_VARIABLE_LIMIT: int = 999
 | 
					SQLITE_DEFAULT_VARIABLE_LIMIT: int = 999
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,8 @@ import uuid
 | 
				
			|||||||
import peewee
 | 
					import peewee
 | 
				
			||||||
import pytest
 | 
					import pytest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import peewee_plus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.fixture(scope="function")
 | 
					@pytest.fixture(scope="function")
 | 
				
			||||||
def fakedb(tmp_path):
 | 
					def fakedb(tmp_path):
 | 
				
			||||||
@@ -10,13 +12,7 @@ def fakedb(tmp_path):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    sqlite = peewee.SqliteDatabase(
 | 
					    sqlite = peewee.SqliteDatabase(
 | 
				
			||||||
        str(tmp_path / f"{uuid.uuid4()}.db"),
 | 
					        str(tmp_path / f"{uuid.uuid4()}.db"),
 | 
				
			||||||
        pragmas={
 | 
					        pragmas=peewee_plus.SQLITE_DEFAULT_PRAGMAS,
 | 
				
			||||||
            "journal_mode": "wal",
 | 
					 | 
				
			||||||
            "cache_size": -1 * 64000,
 | 
					 | 
				
			||||||
            "foreign_keys": 1,
 | 
					 | 
				
			||||||
            "ignore_check_constraints": 0,
 | 
					 | 
				
			||||||
            "synchronous": 0,
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    yield sqlite
 | 
					    yield sqlite
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user