335g commented on code in PR #1666:
URL: https://github.com/apache/iceberg-rust/pull/1666#discussion_r2384242884


##########
crates/catalog/sql/src/catalog.rs:
##########
@@ -54,6 +61,125 @@ static MAX_CONNECTIONS: u32 = 10; // Default the SQL pool 
to 10 connections if n
 static IDLE_TIMEOUT: u64 = 10; // Default the maximum idle timeout per 
connection to 10s before it is closed
 static TEST_BEFORE_ACQUIRE: bool = true; // Default the health-check of each 
connection to enabled prior to returning
 
+/// Builder for [`SqlCatalog`]
+#[derive(Debug)]
+pub struct SqlCatalogBuilder(SqlCatalogConfig);
+
+impl Default for SqlCatalogBuilder {
+    fn default() -> Self {
+        Self(SqlCatalogConfig {
+            uri: "".to_string(),
+            name: "".to_string(),
+            warehouse_location: "".to_string(),
+            file_io: FileIOBuilder::new_fs_io().build().unwrap(),
+            sql_bind_style: SqlBindStyle::DollarNumeric,
+            props: HashMap::new(),
+        })
+    }
+}
+
+impl SqlCatalogBuilder {
+    /// Configure the database URI
+    ///
+    /// If `SQL_CATALOG_PROP_URI` has a value set in `props` during 
`SqlCatalogBuilder::load`,
+    /// that value takes precedence, and the value specified by this method 
will not be used.
+    pub fn uri(mut self, uri: impl Into<String>) -> Self {
+        self.0.uri = uri.into();
+        self
+    }
+
+    /// Configure the warehouse location
+    ///
+    /// If `SQL_CATALOG_PROP_WAREHOUSE` has a value set in `props` during 
`SqlCatalogBuilder::load`,
+    /// that value takes precedence, and the value specified by this method 
will not be used.
+    pub fn warehouse_location(mut self, location: impl Into<String>) -> Self {
+        self.0.warehouse_location = location.into();
+        self
+    }
+
+    /// Configure the bound SQL Statement
+    ///
+    /// If `SQL_CATALOG_PROP_BIND_STYLE` has a value set in `props` during 
`SqlCatalogBuilder::load`,
+    /// that value takes precedence, and the value specified by this method 
will not be used.
+    pub fn sql_bind_style(mut self, sql_bind_style: SqlBindStyle) -> Self {
+        self.0.sql_bind_style = sql_bind_style;
+        self
+    }
+
+    /// Configure the any properties
+    ///
+    /// If the same key has values set in `props` during 
`SqlCatalogBuilder::load`,
+    /// those values will take precedence.
+    pub fn props(mut self, props: HashMap<String, String>) -> Self {
+        self.0.props = props;

Review Comment:
   Fixed in [the 
commit](https://github.com/apache/iceberg-rust/pull/1666/commits/a6dfdd506783fb4bdc29b7b05163c53b381b8bb9).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to