@@ -532,7 +532,7 @@ def connect(
532532 host : str | None = "" ,
533533 port : str | int | None = "" ,
534534 socket : str | None = "" ,
535- charset : str | None = "" ,
535+ character_set : str | None = "" ,
536536 local_infile : bool = False ,
537537 ssl : dict [str , Any ] | None = None ,
538538 ssh_user : str | None = "" ,
@@ -590,17 +590,17 @@ def connect(
590590 # default_character_set doesn't check in self.config_without_package_defaults, because the
591591 # option already existed before the my.cnf deprecation. For the same reason,
592592 # default_character_set can be in [connection] or [main].
593- if not charset :
593+ if not character_set :
594594 if 'default_character_set' in self .config ['connection' ]:
595- charset = self .config ['connection' ]['default_character_set' ]
595+ character_set = self .config ['connection' ]['default_character_set' ]
596596 elif 'default_character_set' in self .config ['main' ]:
597- charset = self .config ['main' ]['default_character_set' ]
597+ character_set = self .config ['main' ]['default_character_set' ]
598598 elif 'default_character_set' in cnf :
599- charset = cnf ['default_character_set' ]
599+ character_set = cnf ['default_character_set' ]
600600 elif 'default-character-set' in cnf :
601- charset = cnf ['default-character-set' ]
602- if not charset :
603- charset = 'utf8mb4'
601+ character_set = cnf ['default-character-set' ]
602+ if not character_set :
603+ character_set = 'utf8mb4'
604604
605605 # Favor whichever local_infile option is set.
606606 use_local_infile = False
@@ -683,7 +683,7 @@ def _connect() -> None:
683683 host ,
684684 int_port ,
685685 socket ,
686- charset ,
686+ character_set ,
687687 use_local_infile ,
688688 ssl_config_or_none ,
689689 ssh_user ,
@@ -704,7 +704,7 @@ def _connect() -> None:
704704 host ,
705705 int_port ,
706706 socket ,
707- charset ,
707+ character_set ,
708708 use_local_infile ,
709709 None ,
710710 ssh_user ,
@@ -1712,7 +1712,7 @@ def get_last_query(self) -> str | None:
17121712@click .option (
17131713 "--unbuffered" , is_flag = True , help = "Instead of copying every row of data into a buffer, fetch rows as needed, to save memory."
17141714)
1715- @click .option ("--charset" , type = str , help = "Character set for MySQL session." )
1715+ @click .option ("--character-set" , "-- charset" , type = str , help = "Character set for MySQL session." )
17161716@click .option (
17171717 "--password-file" , type = click .Path (), help = "File or FIFO path containing the password to connect to the db if not specified otherwise."
17181718)
@@ -1777,7 +1777,7 @@ def cli(
17771777 ssh_warning_off : bool | None ,
17781778 init_command : str | None ,
17791779 unbuffered : bool | None ,
1780- charset : str | None ,
1780+ character_set : str | None ,
17811781 password_file : str | None ,
17821782 noninteractive : bool ,
17831783 batch_format : str | None ,
@@ -2165,7 +2165,7 @@ def get_password_from_file(password_file: str | None) -> str | None:
21652165 ssh_key_filename = ssh_key_filename ,
21662166 init_command = combined_init_cmd ,
21672167 unbuffered = unbuffered ,
2168- charset = charset ,
2168+ character_set = character_set ,
21692169 use_keyring = use_keyring ,
21702170 reset_keyring = reset_keyring ,
21712171 )
0 commit comments