Data objects synonyms are being used by MSSQL server for declaring aliases when using data objects inside SQL expressions e.g.
CREATE SYNONYM MyProduct
FOR AdventureWorks2022.Production.Product;
GO
-- Query the Product table by using the synonym.
SELECT ProductID, Name
FROM MyProduct
WHERE ProductID < 5;
This operation is not supported by other database engines like PostgreSQL, MySQL, Sqlite etc and should be supported by an agnostic SQL parser like SqlFormatter.
Solution
SqlFormatter might use @themost/events#SyncSeriesEventEmitter for allowing event subscription during SqlFormatter.escapeName for allowing subscribers to modify the result of this function.
- The above might be controlled by a service e.g.
SqlSynonym which will allow adding synonyms at process or application level.
SqlFormatter subclasses should folllow this spec for allowing the parsing of data objects names.
Data objects synonyms are being used by MSSQL server for declaring aliases when using data objects inside SQL expressions e.g.
This operation is not supported by other database engines like PostgreSQL, MySQL, Sqlite etc and should be supported by an agnostic SQL parser like
SqlFormatter.Solution
SqlFormattermight use@themost/events#SyncSeriesEventEmitterfor allowing event subscription duringSqlFormatter.escapeNamefor allowing subscribers to modify the result of this function.SqlSynonymwhich will allow adding synonyms at process or application level.SqlFormattersubclasses should folllow this spec for allowing the parsing of data objects names.