diff --git a/dozer-ingestion/oracle/src/connector/listing.rs b/dozer-ingestion/oracle/src/connector/listing.rs index 1548593f90..33abd6f2bc 100644 --- a/dozer-ingestion/oracle/src/connector/listing.rs +++ b/dozer-ingestion/oracle/src/connector/listing.rs @@ -15,17 +15,14 @@ pub struct TableColumn { } impl TableColumn { - pub fn list( - connection: &Connection, - table_names: &[String], - ) -> Result, Error> { - assert!(!table_names.is_empty()); + pub fn list(connection: &Connection, schemas: &[String]) -> Result, Error> { + assert!(!schemas.is_empty()); let sql = " SELECT OWNER, TABLE_NAME, COLUMN_NAME, DATA_TYPE, NULLABLE, DATA_PRECISION, DATA_SCALE FROM ALL_TAB_COLUMNS - WHERE TABLE_NAME IN (:2) + WHERE OWNER IN (SELECT COLUMN_VALUE FROM TABLE(:2)) "; - let schemas = super::string_collection(connection, table_names)?; + let schemas = super::string_collection(connection, schemas)?; debug!("{}, {}", sql, schemas); let rows = connection.query_as::<( String, @@ -66,9 +63,9 @@ pub struct ConstraintColumn { impl ConstraintColumn { pub fn list( connection: &Connection, - table_names: &[String], + schemas: &[String], ) -> Result, Error> { - assert!(!table_names.is_empty()); + assert!(!schemas.is_empty()); let sql = " SELECT OWNER, @@ -76,9 +73,9 @@ impl ConstraintColumn { TABLE_NAME, COLUMN_NAME FROM ALL_CONS_COLUMNS - WHERE TABLE_NAME IN (:2) + WHERE OWNER IN (SELECT COLUMN_VALUE FROM TABLE(:2)) "; - let schemas = super::string_collection(connection, table_names)?; + let schemas = super::string_collection(connection, schemas)?; debug!("{}, {}", sql, schemas); let rows = connection.query_as::<(String, String, String, Option)>(sql, &[&schemas])?; @@ -113,7 +110,7 @@ impl Constraint { CONSTRAINT_NAME FROM ALL_CONSTRAINTS WHERE - TABLE_NAME IN (SELECT COLUMN_VALUE FROM TABLE(:2)) + OWNER IN (SELECT COLUMN_VALUE FROM TABLE(:2)) AND CONSTRAINT_TYPE = 'P' "; diff --git a/dozer-ingestion/oracle/src/connector/mod.rs b/dozer-ingestion/oracle/src/connector/mod.rs index b6e647cd61..5fb3be5961 100644 --- a/dozer-ingestion/oracle/src/connector/mod.rs +++ b/dozer-ingestion/oracle/src/connector/mod.rs @@ -159,7 +159,12 @@ impl Connector { // List all tables and columns. let schemas = tables .iter() - .map(|table| table.name.clone()) + .map(|table| { + table + .schema + .clone() + .unwrap_or_else(|| self.username.clone()) + }) .collect::>(); let table_columns = listing::TableColumn::list(&self.connection, &schemas.into_iter().collect::>())?; @@ -201,7 +206,12 @@ impl Connector { // Collect all tables and columns. let schemas = table_infos .iter() - .map(|table| table.name.clone()) + .map(|table| { + table + .schema + .clone() + .unwrap_or_else(|| self.username.clone()) + }) .collect::>() .into_iter() .collect::>();