77
88from sqlalchemy import MetaData
99
10+ from datafaker .interactive .base import DbCmd
1011from datafaker .interactive .generators import GeneratorCmd , try_setting_generator
1112from datafaker .interactive .missingness import MissingnessCmd
1213from datafaker .interactive .table import TableCmd
2526
2627
2728def update_config_tables (
28- src_dsn : str , src_schema : str | None , metadata : MetaData , config : MutableMapping
29+ src_dsn : str ,
30+ src_schema : str | None ,
31+ metadata : MetaData ,
32+ config : MutableMapping ,
33+ parquet_dir : Path | None ,
2934) -> Mapping [str , Any ]:
3035 """Ask the user to specify what should happen to each table."""
31- with TableCmd (src_dsn , src_schema , metadata , config ) as tc :
36+ settings = DbCmd .Settings (src_dsn , src_schema , config , metadata , parquet_dir )
37+ with TableCmd (settings ) as tc :
3238 tc .cmdloop ()
3339 return tc .config
3440
@@ -38,6 +44,7 @@ def update_missingness(
3844 src_schema : str | None ,
3945 metadata : MetaData ,
4046 config : MutableMapping [str , Any ],
47+ parquet_dir : Path | None ,
4148) -> Mapping [str , Any ]:
4249 """
4350 Ask the user to update the missingness information in ``config.yaml``.
@@ -49,16 +56,14 @@ def update_missingness(
4956 :param config: The starting configuration,
5057 :return: The updated configuration.
5158 """
52- with MissingnessCmd (src_dsn , src_schema , metadata , config ) as mc :
59+ settings = DbCmd .Settings (src_dsn , src_schema , config , metadata , parquet_dir )
60+ with MissingnessCmd (settings ) as mc :
5361 mc .cmdloop ()
5462 return mc .config
5563
5664
5765def update_config_generators (
58- src_dsn : str ,
59- src_schema : str | None ,
60- metadata : MetaData ,
61- config : MutableMapping [str , Any ],
66+ settings : DbCmd .Settings ,
6267 spec_path : Path | None ,
6368) -> Mapping [str , Any ]:
6469 """
@@ -68,14 +73,11 @@ def update_config_generators(
6873 Column name (or space-separated list of column names), Generator
6974 name required, Second choice generator name, Third choice generator
7075 name, etcetera.
71- :param src_dsn: Address of the source database
72- :param src_schema: Name of the source database schema to read from
73- :param metadata: SQLAlchemy representation of the source database
74- :param config: Existing configuration (will be destructively updated)
76+ :param settings: Source database settings.
7577 :param spec_path: The path of the CSV file containing the specification
7678 :return: Updated configuration.
7779 """
78- with GeneratorCmd (src_dsn , src_schema , metadata , config ) as gc :
80+ with GeneratorCmd (settings ) as gc :
7981 if spec_path is None :
8082 gc .cmdloop ()
8183 return gc .config
0 commit comments