@@ -52,29 +52,6 @@ def connection_string(self) -> str:
5252 return f'{ self .kind } ://{ self .path } '
5353
5454
55- @dataclass
56- class MySQLDatabaseConfig :
57- """MySQL database connection config
58-
59- :param host: Host
60- :param port: Port
61- :param user: User
62- :param password: Password
63- :param database: Database name
64- """
65-
66- kind : Literal ['mysql' ]
67- host : str
68- port : int
69- user : str
70- database : str
71- password : str = ''
72-
73- @property
74- def connection_string (self ) -> str :
75- return f'{ self .kind } ://{ self .user } :{ self .password } @{ self .host } :{ self .port } /{ self .database } '
76-
77-
7855@dataclass
7956class PostgresDatabaseConfig :
8057 """Postgres database connection config
@@ -85,6 +62,7 @@ class PostgresDatabaseConfig:
8562 :param password: Password
8663 :param database: Database name
8764 :param schema_name: Schema name
65+ :param immune_tables: List of tables to preserve during reindexing
8866 """
8967
9068 kind : Literal ['postgres' ]
@@ -94,11 +72,18 @@ class PostgresDatabaseConfig:
9472 database : str
9573 schema_name : str = 'public'
9674 password : str = ''
75+ immune_tables : Optional [List [str ]] = None
9776
9877 @property
9978 def connection_string (self ) -> str :
10079 return f'{ self .kind } ://{ self .user } :{ self .password } @{ self .host } :{ self .port } /{ self .database } ?schema={ self .schema_name } '
10180
81+ @validator ('immune_tables' )
82+ def valid_immune_tables (cls , v ):
83+ if v and 'dipdup_state' in v :
84+ raise ConfigurationError ('`dipdup_state` table can\' t be immune' )
85+ return v
86+
10287
10388@dataclass
10489class ContractConfig :
@@ -635,7 +620,6 @@ class DipDupConfig:
635620 :param templates: Mapping of template aliases and index templates
636621 :param database: Database config
637622 :param hasura: Hasura config
638- :param configuration: Dynamic configuration parameters
639623 """
640624
641625 spec_version : str
@@ -644,7 +628,7 @@ class DipDupConfig:
644628 contracts : Dict [str , ContractConfig ] = Field (default_factory = dict )
645629 indexes : Dict [str , IndexConfigT ] = Field (default_factory = dict )
646630 templates : Optional [Dict [str , IndexConfigTemplateT ]] = None
647- database : Union [SqliteDatabaseConfig , MySQLDatabaseConfig , PostgresDatabaseConfig ] = SqliteDatabaseConfig (kind = 'sqlite' )
631+ database : Union [SqliteDatabaseConfig , PostgresDatabaseConfig ] = SqliteDatabaseConfig (kind = 'sqlite' )
648632 hasura : Optional [HasuraConfig ] = None
649633
650634 def __post_init_post_parse__ (self ):
0 commit comments