@@ -402,3 +402,34 @@ def drop_schema(
402402 # No catalog qualification, use as-is
403403 logger .debug (f"No catalog detected, using original: { schema_name } " )
404404 super ().drop_schema (schema_name , ignore_if_not_exists , cascade , ** drop_args )
405+
406+ def create_schema (
407+ self ,
408+ schema_name : t .Union [str , exp .Table ],
409+ ignore_if_exists : bool = True ,
410+ ** kwargs : t .Any ,
411+ ) -> None :
412+ """
413+ Override create_schema to handle catalog-qualified schema names.
414+ Fabric doesn't support 'CREATE SCHEMA [catalog].[schema]' syntax.
415+ """
416+ logger .debug (f"create_schema called with: { schema_name } (type: { type (schema_name )} )" )
417+
418+ # If it's a string with a dot, assume it's catalog.schema format
419+ if isinstance (schema_name , str ) and "." in schema_name :
420+ parts = schema_name .split ("." , 1 ) # Split only on first dot
421+ catalog_name = parts [0 ].strip ('"[]' ) # Remove quotes/brackets
422+ schema_only = parts [1 ].strip ('"[]' )
423+ logger .debug (
424+ f"Detected catalog.schema format: catalog='{ catalog_name } ', schema='{ schema_only } '"
425+ )
426+
427+ # Switch to the catalog first
428+ self .set_current_catalog (catalog_name )
429+
430+ # Use just the schema name
431+ super ().create_schema (schema_only , ignore_if_exists , ** kwargs )
432+ else :
433+ # No catalog qualification, use as-is
434+ logger .debug (f"No catalog detected, using original: { schema_name } " )
435+ super ().create_schema (schema_name , ignore_if_exists , ** kwargs )
0 commit comments