Skip to content

Commit

Permalink
fix(literal): allow creating ibis literal with uuid (#3131)
Browse files Browse the repository at this point in the history
* fix(literal): allow creating ibis literal with uuid

```
import ibis
import uuid

value = uuid.uuid4()
x = ibis.literal(value, type="uuid")
```

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(literal): allow creating ibis literal with uuid

```
import ibis
import uuid

value = uuid.uuid4()
x = ibis.literal(value, type="uuid")
```

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(import): please don't delete a needed import

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
gforsyth and pre-commit-ci[bot] authored Nov 22, 2021
1 parent b18a896 commit b0f4f44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ibis/expr/operations/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import enum
import functools
import itertools
import uuid

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -247,6 +248,7 @@ class Literal(ValueOp):
str,
tuple,
type(None),
uuid.UUID,
)
),
rlz.is_computable_input,
Expand Down
3 changes: 3 additions & 0 deletions ibis/tests/expr/test_value_exprs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools
import operator
import os
import uuid
from collections import OrderedDict
from datetime import date, datetime, time
from operator import methodcaller
Expand Down Expand Up @@ -118,6 +119,8 @@ def test_literal_with_implicit_type(value, expected_type):
(tuple(multipoint), 'multipoint'),
(list(multipolygon1), 'multipolygon'),
(tuple(multipolygon1), 'multipolygon'),
(uuid.uuid4(), 'uuid'),
(str(uuid.uuid4()), 'uuid'),
],
)
def test_literal_with_explicit_type(value, expected_type):
Expand Down

0 comments on commit b0f4f44

Please sign in to comment.