Open
Description
Is your feature request related to a problem?
issue: Schema.to_sqlglot()
The semantics of .to_sqlglot()
are a bit confusing. I expected the output to be a sqlglot.schema.Schema type with a single table.
Maybe it could be renamed to .to_sqlglot_columns_definition()
?
edit: I see some of this logic in available in ibis/expr/sql.py
add: Schema.from_sqlglot()
I'm working on dlt-hub/dlt and we use Ibis and SQLGlot for some internal component.
Currently, we maintain type-mapping between dlt <-> ibis
and dlt <-> sqlglot
. Some operations need schema conversion from ibis -> sqlglot
or sqlglot -> ibis
.
I would be convenient if Schema.from_sqlglot()
was supported (Schema.to_sqlglot()
already existing). This would streamline conversions between tools.
What is the motivation behind your request?
No response
Describe the solution you'd like
import sqlglot.schema
class Schema:
# ...
@classmethod
def from_sqlglot(cls, sqlglot_schema: sqlglot.schema.Schema) -> "Schema":
from ibis.formats.sqlglot import SQLGlotSchema
return SQLGlotSchema.to_ibis(sqlglot_schema)
def to_sqlglot(self) -> sqlglot.schema.Schema:
from ibis.formats.sqlglot import SQLGlotSchema
return SQLGlotSchema.from_ibis(self)
def to_sqlglot_columns_definition(self):
# logic of the current `.to_sqlglot()`
What version of ibis are you running?
10.5.0
What backend(s) are you using, if any?
Used to support multiple backends
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Type
Projects
Status
backlog