@@ -1309,36 +1309,26 @@ def create_view(
13091309 database : str | None = None ,
13101310 overwrite : bool = False ,
13111311 ) -> ir .Table :
1312- table_loc = self ._to_sqlglot_table (database )
1313- catalog , db = self ._to_catalog_db_tuple (table_loc )
1312+ project_id , dataset = self ._parse_project_and_dataset (database )
13141313
13151314 stmt = sge .Create (
13161315 kind = "VIEW" ,
1317- this = sg .table (
1318- name ,
1319- db = db or self .current_database ,
1320- catalog = catalog or self .billing_project ,
1321- ),
1316+ this = sg .table (name , db = dataset , catalog = project_id ),
13221317 expression = self .compile (obj ),
13231318 replace = overwrite ,
13241319 )
13251320 self ._run_pre_execute_hooks (obj )
13261321 self .raw_sql (stmt .sql (self .name ))
1327- return self .table (name , database = (catalog , database ))
1322+ return self .table (name , database = (project_id , dataset ))
13281323
13291324 def drop_view (
13301325 self , name : str , / , * , database : str | None = None , force : bool = False
13311326 ) -> None :
1332- table_loc = self ._to_sqlglot_table (database )
1333- catalog , db = self ._to_catalog_db_tuple (table_loc )
1327+ project_id , dataset = self ._parse_project_and_dataset (database )
13341328
13351329 stmt = sge .Drop (
13361330 kind = "VIEW" ,
1337- this = sg .table (
1338- name ,
1339- db = db or self .current_database ,
1340- catalog = catalog or self .billing_project ,
1341- ),
1331+ this = sg .table (name , db = dataset , catalog = project_id ),
13421332 exists = force ,
13431333 )
13441334 self .raw_sql (stmt .sql (self .name ))
0 commit comments