@@ -676,10 +676,34 @@ def get_description(cls) -> str:
676676 "description" : "Schema name to import data from" ,
677677 "default" : "public" ,
678678 },
679+ "use_remote_estimate" : {
680+ "type" : "boolean" ,
681+ "default" : False ,
682+ "title" : "Use remote EXPLAIN" ,
683+ "description" : "Issue remote EXPLAIN commands to obtain cost estimates" ,
684+ },
685+ "fetch_size" : {
686+ "type" : "integer" ,
687+ "title" : "Fetch size" ,
688+ "description" : "Number of rows from the remote server to get in each fetch operation" ,
689+ "default" : 10000 ,
690+ },
679691 },
680692 "required" : ["host" , "port" , "dbname" , "remote_schema" ],
681693 }
682694
695+ table_params_schema = merge_jsonschema (
696+ ForeignDataWrapperDataSource .table_params_schema ,
697+ {
698+ "type" : "object" ,
699+ "properties" : {
700+ "table_name" : {"type" : "string" , "title" : "Table name" },
701+ "schema_name" : {"type" : "string" , "title" : "Schema name" },
702+ },
703+ "required" : [],
704+ },
705+ )
706+
683707 commandline_help : str = """Mount a Postgres database.
684708
685709Mounts a schema on a remote Postgres database as a set of foreign tables locally."""
@@ -700,6 +724,8 @@ def get_server_options(self):
700724 "host" : self .params ["host" ],
701725 "port" : str (self .params ["port" ]),
702726 "dbname" : self .params ["dbname" ],
727+ "use_remote_estimate" : "true" if self .params .get ("use_remote_estimate" ) else "false" ,
728+ "fetch_size" : int (self .params .get ("fetch_size" , 10000 )),
703729 ** self .params .get ("extra_server_args" , {}),
704730 }
705731
@@ -708,7 +734,7 @@ def get_user_options(self):
708734
709735 def get_table_options (self , table_name : str , tables : Optional [TableInfo ] = None ):
710736 options = super ().get_table_options (table_name , tables )
711- options ["schema_name" ] = self .params ["remote_schema" ]
737+ options ["schema_name" ] = options . get ( "schema_name" , self .params ["remote_schema" ])
712738 return options
713739
714740 def get_fdw_name (self ):
0 commit comments