diff --git a/pydbapi/api/trino.py b/pydbapi/api/trino.py index da04a70..3dbe49f 100644 --- a/pydbapi/api/trino.py +++ b/pydbapi/api/trino.py @@ -2,7 +2,7 @@ # @Author: longfengpili # @Date: 2023-06-02 15:27:41 # @Last Modified by: longfengpili -# @Last Modified time: 2024-03-04 18:15:24 +# @Last Modified time: 2024-03-04 18:28:25 # @github: https://github.com/longfengpili @@ -152,8 +152,8 @@ def insert(self, tablename, columns, inserttype='value', values=None, chunksize= return rows, action, result def alter_tablecol(self, tablename: str, colname: str, newname: str = None, newtype: str = None, - partition: str = 'part_date', conditions: list[str] = None, verbose: int = 0): - alter_columns = self.alter_column(tablename, colname, newname, newtype) + sqlexpr: str = None, partition: str = 'part_date', conditions: list[str] = None, verbose: int = 0): + alter_columns = self.alter_column(tablename, colname, newname, newtype, sqlexpr) if alter_columns: # create tmp table diff --git a/tests/trino/test_trino.py b/tests/trino/test_trino.py index 3827cb9..c370977 100644 --- a/tests/trino/test_trino.py +++ b/tests/trino/test_trino.py @@ -2,7 +2,7 @@ # @Author: longfengpili # @Date: 2023-06-02 15:27:41 # @Last Modified by: longfengpili -# @Last Modified time: 2024-03-01 12:09:05 +# @Last Modified time: 2024-03-04 18:47:44 # @github: https://github.com/longfengpili @@ -201,5 +201,9 @@ def test_alter_col(self): alter_cols = self.trinodb.alter_column(self.tablename, 'id', 'idx', 'int') print(alter_cols) - def test_alter_table(self): + def test_alter_tablecol(self): self.trinodb.alter_tablecol(self.tablename, colname='id', newname='idx', newtype='int', partition='birthday') + + def test_alter_tablecol1(self): + self.trinodb.alter_tablecol(self.tablename, colname='idx', newname='idx', + newtype='int', sqlexpr='idx * 10', partition='birthday')