pub struct SQLImporter {
pub dialect: String,
}Expand description
SQL Importer - parses CREATE TABLE statements
Fields§
§dialect: StringSQL dialect to use for parsing
Implementations§
Source§impl SQLImporter
impl SQLImporter
Sourcepub fn parse(&self, sql: &str) -> Result<ImportResult>
pub fn parse(&self, sql: &str) -> Result<ImportResult>
Parse SQL and extract table definitions
§Arguments
sql- SQL string containing CREATE TABLE statements
§Returns
An ImportResult containing extracted tables and any parse errors.
§Example
use data_modelling_sdk::import::sql::SQLImporter;
let importer = SQLImporter::new("postgres");
let sql = "CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(100));";
let result = importer.parse(sql).unwrap();
assert_eq!(result.tables.len(), 1);Sourcepub fn parse_liquibase(&self, sql: &str) -> Result<ImportResult>
pub fn parse_liquibase(&self, sql: &str) -> Result<ImportResult>
Parse SQL with Liquibase format support
Strips Liquibase directive comments (–liquibase formatted sql, –changeset, etc.) before parsing the SQL.
§Arguments
sql- SQL string with optional Liquibase comments
§Returns
An ImportResult containing extracted tables.
§Example
use data_modelling_sdk::import::sql::SQLImporter;
let importer = SQLImporter::new("postgres");
let sql = r#"
--liquibase formatted sql
--changeset user:1
CREATE TABLE users (id INT);
"#;
let result = importer.parse_liquibase(sql).unwrap();Trait Implementations§
Auto Trait Implementations§
impl Freeze for SQLImporter
impl RefUnwindSafe for SQLImporter
impl Send for SQLImporter
impl Sync for SQLImporter
impl Unpin for SQLImporter
impl UnwindSafe for SQLImporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more