Coverage for databases/_types.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2024-08-27 18:25 +0000

1from typing import Generic, TypeVar 

2from typing_extensions import Literal, TypedDict 

3 

4_T = TypeVar('_T') 

5 

6 

7# NOTE: these must be lowercase as CLI arguments are converted to 

8# lowercase for ease of use. 

9# 

10# NOTE: if you update this, you must also update the `DatabaseMapping` type 

11SupportedDatabase = Literal[ 

12 'mysql', 

13 'sqlite', 

14 'mariadb', 

15 'postgresql', 

16 'cockroachdb', 

17] 

18 

19 

20class DatabaseMapping(TypedDict, Generic[_T]): 

21 """Represents a mapping of database names to a generic type. 

22 

23 This is useful to enforce that a mapping represents all valid database providers 

24 """ 

25 

26 mysql: _T 

27 sqlite: _T 

28 mariadb: _T 

29 postgresql: _T 

30 cockroachdb: _T