mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
db.rename_table() method, refs #565
This commit is contained in:
parent
86a352f8b7
commit
82e8cd3667
3 changed files with 44 additions and 2 deletions
|
|
@ -1040,6 +1040,19 @@ class Database:
|
|||
)
|
||||
return cast(Table, created_table)
|
||||
|
||||
def rename_table(self, name: str, new_name: str):
|
||||
"""
|
||||
Rename a table.
|
||||
|
||||
:param name: Current table name
|
||||
:param new_name: Name to rename it to
|
||||
"""
|
||||
self.execute(
|
||||
"ALTER TABLE [{name}] RENAME TO [{new_name}]".format(
|
||||
name=name, new_name=new_name
|
||||
)
|
||||
)
|
||||
|
||||
def create_view(
|
||||
self, name: str, sql: str, ignore: bool = False, replace: bool = False
|
||||
):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue