Comments (8)
Hello.
Ok, the real error was:
pyexasol.exceptions.ExaRequestError:
(
message => getString: JSON value is not a string. (Session: 1665483672788760589)
dsn => exasol-dev.mlan:8563
user => SYS
schema => PYEXASOL_TEST
code => 00000
)
I'll push an update to display this error properly.
The problem is related to data types. If you have column NNUMBER
with type VARCHAR, Exasol prepared statement expects you to send string as data for such column. And if you have type DECIMAL or DOUBLE PRECISION, Exasol expects you to send number. Basically, this is how Exasol WebSocket protocol works at this moment.
We cannot handle it on client side, since it will require checking table structure in advance and full iteration over all rows, which is too expensive.
In my opinion, it's much better to use .import_from_pandas()
in most of cases and avoid INSERT with prepared statements altogether.
from pyexasol.
Error message will be displayed properly starting from 0.12.1
. This version is available now.
from pyexasol.
Thanks. Upgraded my version
Also, a second issue when inserting null value into decimal numbers:
CREATE TABLE SAMPLE_SCHEMA.TABLE1(
NNUMBER NUMERIC(20,10),
WWORD VARCHAR(20000)
)
Code:
import pyexasol
import pandas as pd
print(pyexasol.__version__)
print(pd.__version__)
def get_connection():
conn = pyexasol.connect(
dsn="DSN",
user="USERNAME",
password="PASSWORD")
return conn
tuple_list = [
(3.1415926, "AAA"),("", "BBB")
]
# Empty string to represent missing value
df = pd.DataFrame(tuple_list, columns=["NNUMBER", "WWORD"])
conn = get_connection()
conn.import_from_pandas(df, ("SAMPLE_SCHEMA", "TABLE1"))
conn.commit()
print("Step 1 OK")
conn.ext.insert_multi(("SAMPLE_SCHEMA", "TABLE1"),tuple_list,columns=list(df.columns))
conn.commit()
print("Step 4 OK") # <-- Will never be reached.
Output:
0.12.1
1.0.3
Step 1 OK
Error.......
The error goes away if I use None instead of empty string "" to represent the error
I get an error message thatlooks like this:
pyexasol.exceptions.ExaCommunicationError:
(
message => Connection is already closed.
dsn => ................
user => .............
schema =>
from pyexasol.
Huh, interesting! I'll take a look today or tomorrow.
It might be possible that NULLs (as None
values) are not properly supported by Exasol prepared statements.
Switching to .import_from_pandas()
should definitely help with this issue.
from pyexasol.
@CHBEXD , ok, I've tested the input value for DECIMAL column with empty string.
It actually causes crash in SQLProcess.
The error message is:
11.05 19:07:24.932 �[31;1mERROR �[0mCC: Thread will be terminated because an std::exception has been caught: [22018] invalid character value for cast; input is empty or spaces only
11.05 19:07:24.932 �[33mEXAOP_WARNING Internal error in SqlProcess of session: 1666422190107996613.�[0m
###########################################
11.05 19:07:24
Program received signal 15 (SIGTERM) because of tkill() or tgkill() (-).
Signal was raised by this process.
Since the problem is on server side, I'll raise a ticket for Exasol support. I guess, it has to be a proper error message instead of crash.
Thank you.
from pyexasol.
I'll post a link to the EXA ticket when it will be available for the public access.
from pyexasol.
@CHBEXD , ticket is now available: https://www.exasol.com/support/browse/EXASOL-2702
Thank you.
from pyexasol.
Exasol ticket was resolved. I'll close this ticket. Fix should be applied on Exasol server side, nothing to do on client.
from pyexasol.
Related Issues (20)
- Mixed type error message HOT 3
- Support for Polars HOT 8
- Migrate project setup to poetry
- export_to_file running out of memory HOT 8
- 🐞WebSocket connection isn't properly closed in case of process termination HOT 4
- ✨ Add support for converting `TIMESTAMP WITH LOCAL TIME ZONE` to exasol_mapper
- ✨ Create a `1.0.0` release
- Mistake in documentation of import_from_iterable HOT 2
- Enabling connection encryption by default on PyExasol HOT 5
- Add job name to .github/workflows/examples.yml HOT 5
- Pyexasol with SaaS Authentication error HOT 5
- Could not connect to Exasol: [SSL: LENGTH_MISMATCH] length mismatch (_ssl.c:1129) HOT 4
- Document that Connection sharing with multiprocessing doesn't work with TLS Encryption HOT 6
- Connection from pyexasol to Exasol SaaS HOT 20
- pyexasol not raising an Exception on Exasol error HOT 10
- profiling a script with pyexasol with scalene HOT 6
- bigint and certain decimals returned as string HOT 5
- respect `no_proxy` environment variable HOT 2
- Pyexasol raises FutureWarning HOT 4
- decimal separator is wrong when Exasol Column is DOUBLE and NLS_NUMERIC_CHARACTERS = ',.' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyexasol.