Skip to content

Commit

Permalink
feat(duckdb): support dt.MACADDR, dt.INET as string
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Jan 28, 2023
1 parent de73b37 commit c4739c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ibis/backends/duckdb/datatypes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import parsy as p
import sqlalchemy as sa
import toolz
from duckdb_engine import Dialect as DuckDBDialect
from sqlalchemy.dialects import postgresql
Expand Down Expand Up @@ -148,3 +149,8 @@ def parse_type(*args, **kwargs):
@to_sqla_type.register(DuckDBDialect, dt.UUID)
def sa_duckdb_uuid(_, itype):
return postgresql.UUID


@to_sqla_type.register(DuckDBDialect, (dt.MACADDR, dt.INET))
def sa_duckdb_macaddr(_, itype):
return sa.TEXT()
6 changes: 4 additions & 2 deletions ibis/backends/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,7 @@ def test_exists(batting, awards_players, method_name):
{
'bigquery': "STRING",
'clickhouse': "String",
'duckdb': 'VARCHAR',
'snowflake': "VARCHAR",
'sqlite': "text",
'trino': 'varchar(17)',
Expand All @@ -1190,7 +1191,7 @@ def test_exists(batting, awards_players, method_name):
},
marks=[
pytest.mark.broken(
['duckdb', 'polars'],
['polars'],
"<class 'ibis.expr.datatypes.core.MACADDR'>",
raises=KeyError,
),
Expand All @@ -1202,6 +1203,7 @@ def test_exists(batting, awards_players, method_name):
{
'bigquery': "STRING",
'clickhouse': "IPv4",
'duckdb': 'VARCHAR',
'impala': 'STRING',
'snowflake': "VARCHAR",
'sqlite': "text",
Expand All @@ -1210,7 +1212,7 @@ def test_exists(batting, awards_players, method_name):
},
marks=[
pytest.mark.broken(
['duckdb', 'polars'],
['polars'],
"<class 'ibis.expr.datatypes.core.INET'>",
raises=KeyError,
),
Expand Down

0 comments on commit c4739c7

Please sign in to comment.