hyper-api-samples: tableauhyperapi (v0.0.16123) HyperException: This database does not support 128-bit numerics.
test@local: pip3 list | grep hyper
tableauhyperapi 0.0.16377
What’s New in the Hyper API (v0.0.16123)
December 7, 2022
Added support for 128-bit numerics. This allows a precision of up to 38 for the NUMERIC SQL type.
Run:
from pathlib import Path
from tableauhyperapi import HyperProcess, Telemetry, \
Connection, CreateMode, \
NOT_NULLABLE, NULLABLE, SqlType, TableDefinition, \
Inserter, \
escape_name, escape_string_literal, \
HyperException
customer_table = TableDefinition(
table_name="Customer",
columns=[
TableDefinition.Column("Customer ID", SqlType.text(), NOT_NULLABLE),
TableDefinition.Column("Customer Amount", SqlType.numeric(38,3), NOT_NULLABLE),
TableDefinition.Column("Customer Score", SqlType.big_int(), NOT_NULLABLE)
]
)
path_to_database = Path("customer.hyper")
with HyperProcess(telemetry=Telemetry.SEND_USAGE_DATA_TO_TABLEAU) as hyper:
connection_parameters = {"lc_time": "en_US"}
with Connection(endpoint=hyper.endpoint,
database=path_to_database,
create_mode=CreateMode.CREATE_AND_REPLACE,
parameters=connection_parameters) as connection:
connection.catalog.create_table(table_definition=customer_table)
Output:
---------------------------------------------------------------------------
HyperException Traceback (most recent call last)
Input In [32], in <module>
23 connection_parameters = {"lc_time": "en_US"}
25 with Connection(endpoint=hyper.endpoint,
26 database=path_to_database,
27 create_mode=CreateMode.CREATE_AND_REPLACE,
28 parameters=connection_parameters) as connection:
---> 30 connection.catalog.create_table(table_definition=customer_table)
File ~/.local/lib/python3.8/site-packages/tableauhyperapi/catalog.py:65, in Catalog.create_table(self, table_definition)
59 def create_table(self, table_definition: TableDefinition):
60 """
61 Creates a table. Raise an exception if the table already exists.
62
63 :param table_definition: the table definition.
64 """
---> 65 self.__create_table(table_definition, True)
File ~/.local/lib/python3.8/site-packages/tableauhyperapi/catalog.py:57, in Catalog.__create_table(self, table_definition, fail_if_exists)
55 def __create_table(self, table_definition: TableDefinition, fail_if_exists: bool):
56 native_table_def = SchemaConverter.table_definition_to_native(table_definition)
---> 57 Error.check(hapi.hyper_create_table(self.__cdata, native_table_def.cdata, fail_if_exists))
File ~/.local/lib/python3.8/site-packages/tableauhyperapi/impl/dllutil.py:100, in Error.check(p)
97 if p != ffi.NULL:
98 # this will free the error when it goes out of scope
99 errp = Error(p)
--> 100 raise errp.to_exception()
HyperException: This database does not support 128-bit numerics.
Context: 0xfa6b0e2f
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (9 by maintainers)
Our release notes are confusing… We should fix that.
Hyper API is now able to read and operate on 128 bit numerics. I.e., if you get a 128 bit numeric e.g. from a Parquet file, you can use normal arithmetic on it. But before you store it into a Hyper file
However, there is not yet any Hyper file format version which allows you to write 128 bit numerics. Such a new file format version is already lined up to ship very soon 😃
However, you also have another problem: There is not yet any Tableau version which is able to read 128 bit numerics from Hyper files… Soon 🙂