blaze / datashape

Language defining a data description protocol
BSD 2-Clause "Simplified" License
183 stars 65 forks source link

Decimal type? #118

Closed mrocklin closed 9 years ago

mrocklin commented 9 years ago

Do we want one? They're found in the wild.

mwiebe commented 9 years ago

I specified the IEEE decimal types when I wrote the list of types at https://github.com/ContinuumIO/datashape/blob/master/docs/source/types.rst#decimal-floating-point

rcbensley commented 9 years ago

This is still an issue, you can test this with the Chinook database.

Error:

$ python
Python 3.4.3 |Anaconda 2.3.0 (x86_64)| (default, Mar  6 2015, 12:07:41)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from blaze import Data
>>> d = Data('mysql+pymysql://myfancyuser:mysupercomplexpassword@localhost/Chinook::Track')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/teatime/anaconda3/lib/python3.4/site-packages/blaze-0.8.2+89.gcf357fb-py3.4.egg/blaze/interactive.py", line 68, in Data
    dshape = discover(data)
  File "/Users/teatime/anaconda3/lib/python3.4/site-packages/multipledispatch/dispatcher.py", line 164, in __call__
    return func(*args, **kwargs)
  File "/Users/teatime/anaconda3/lib/python3.4/site-packages/odo/backends/sql.py", line 192, in discover_sqlalchemy_selectable
    records = list(sum([discover(c).parameters[0] for c in t.columns], ()))
  File "/Users/teatime/anaconda3/lib/python3.4/site-packages/odo/backends/sql.py", line 192, in <listcomp>
    records = list(sum([discover(c).parameters[0] for c in t.columns], ()))
  File "/Users/teatime/anaconda3/lib/python3.4/site-packages/multipledispatch/dispatcher.py", line 164, in __call__
    return func(*args, **kwargs)
  File "/Users/teatime/anaconda3/lib/python3.4/site-packages/odo/backends/sql.py", line 187, in discover_sqlalchemy_column
    return Record([[col.name, optionify(discover(col.type))]])
  File "/Users/teatime/anaconda3/lib/python3.4/site-packages/multipledispatch/dispatcher.py", line 164, in __call__
    return func(*args, **kwargs)
  File "/Users/teatime/anaconda3/lib/python3.4/site-packages/odo/backends/sql.py", line 181, in discover_typeengine
    raise NotImplementedError("No SQL-datashape match for type %s" % typ)
NotImplementedError: No SQL-datashape match for type DECIMAL(10, 2)

Sys:

teatime@ttmw:~$ python -V
Python 3.4.3 :: Anaconda 2.3.0 (x86_64)
teatime@ttmw:~$ pip info datashape
ERROR: unknown command "info"
teatime@ttmw:~$ pip show datashape
]---
Metadata-Version: 1.1
Name: datashape
Version: 0.4.6
Summary: A data description language.
Home-page: http://packages.python.org/datashape
Author: Continuum Analytics
Author-email: blaze-dev@continuum.io
License: BSD
Location: /Users/teatime/anaconda3/lib/python3.4/site-packages
Requires:
teatime@ttmw:~$ python -V
Python 3.4.3 :: Anaconda 2.3.0 (x86_64)
teatime@ttmw:~$ uname -a
Darwin ttmw 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,1 Darwin
teatime@ttmw:~$ mysql -V && mysqld -V
mysql  Ver 14.14 Distrib 5.6.26, for osx10.10 (x86_64) using  EditLine wrapper
mysqld  Ver 5.6.26 for osx10.10 on x86_64 (Homebrew)

Fingers crossed for 0.4.7!

For anyone else that ends up here from google, you might want to use pandas.read_sql until DECIMAL support is added; assuming you are trying to use datashape and blaze, and possibly odo.

dan-coates commented 9 years ago

@cpcloud, would you mind specifying some acceptance criteria for implementing Decimal types?

Maybe something like a minimum viable product version that will allow datashape to recognize Decimal yet not implement it in all odo backends or blaze (and not break things while doing so), with a maximal vision that fully implements it wherever it needs to be implemented.

If not, that's fine, but the parts of odo and datashape I've touched to date have been relatively limited and I imagine there are impacts to implementing this I'd be unaware of.

cpcloud commented 9 years ago

closed by #170