Comments (4)
Interesting. Could you please add debug=True
connection option and attach logs?
I suspect, this is how Exasol WebSocket protocol returns float values, regardless of NLS_NUMERIC_CHARACTERS
setting.
from pyexasol.
Here's the Log:
2022-11-30 07:50:33.811 Connection attempt [10.10.30.196:8563]
2022-11-30 07:50:33.842 [WebSocket request #1]
{
"command": "login",
"protocolVersion": 3
}
2022-11-30 07:50:33.842 [WebSocket response #1]
{
"status": "ok",
"responseData": {
"publicKeyPem": "<public key>",
"publicKeyExponent": "010001",
"publicKeyModulus": "<modulus>"
}
}
2022-11-30 07:50:33.983 [WebSocket request #2]
{
"username": "<username>",
"password": "<password>",
"driverName": "PyEXASOL 0.24.0",
"clientName": "PyEXASOL",
"clientVersion": "0.24.0",
"clientOs": "Windows-10-10.0.17763-SP0",
"clientOsUsername": "<username>",
"clientRuntime": "Python 3.9.7",
"useCompression": false,
"attributes": {
"currentSchema": "",
"autocommit": true,
"queryTimeout": 0
}
}
2022-11-30 07:50:33.998 [WebSocket response #2]
{
"status": "ok",
"responseData": {
"protocolVersion": 3,
"timeZone": "EUROPE/BERLIN",
"timeZoneBehavior": "INVALID SHIFT AMBIGUOUS ST",
"sessionId": 1750902846820319232,
"maxDataMessageSize": 67108864,
"releaseVersion": "7.1.6",
"databaseName": "exa_db1_dev",
"productName": "EXASolution",
"maxIdentifierLength": 128,
"maxVarcharLength": 2000000,
"identifierQuoteString": "\""
}
}
2022-11-30 07:50:33.998 [WebSocket request #3]
{
"command": "getAttributes"
}
2022-11-30 07:50:34.029 [WebSocket response #3]
{
"status": "ok",
"attributes": {
"datetimeFormat": "YYYY-MM-DD HH24:MI:SS.FF6",
"dateFormat": "YYYY-MM-DD",
"numericCharacters": ".,",
"dateLanguage": "ENG",
"queryTimeout": 0,
"timezone": "EUROPE/BERLIN",
"timezoneBehavior": "INVALID SHIFT AMBIGUOUS ST",
"snapshotTransactionsEnabled": true,
"defaultLikeEscapeCharacter": "\\",
"autocommit": true,
"compressionEnabled": false,
"currentSchema": "",
"openTransaction": 0
}
}
2022-11-30 07:50:35.811 [WebSocket request #4]
{
"command": "execute",
"sqlText": "EXPORT (\nselect cast(0.5 as DECIMAL(2,2)) as DECIMALCOLUMN\n, cast(0.6 as DOUBLE) as DOUBLECOLUMN\nfrom DUAL\n) INTO CSV\nAT 'https://192.168.100.75:43360' FILE '000.csv'\nWITH COLUMN NAMES"
}
2022-11-30 07:50:36.998 [WebSocket response #4]
{
"status": "ok",
"responseData": {
"results": [
{
"resultType": "rowCount",
"rowCount": 1
}
],
"numResults": 1
}
}
2022-11-30 07:50:37.967 [WebSocket request #5]
{
"command": "execute",
"sqlText": "select cast(0.5 as DECIMAL(2,2)) as DECIMALCOLUMN\n, cast(0.6 as DOUBLE) as DOUBLECOLUMN\nfrom DUAL"
}
2022-11-30 07:50:37.983 [WebSocket response #5]
{
"status": "ok",
"responseData": {
"results": [
{
"resultType": "resultSet",
"resultSet": {
"numColumns": 2,
"numRows": 1,
"numRowsInMessage": 1,
"columns": [
{
"name": "DECIMALCOLUMN",
"dataType": {
"type": "DECIMAL",
"precision": 2,
"scale": 2
}
},
{
"name": "DOUBLECOLUMN",
"dataType": {
"type": "DOUBLE"
}
}
],
"data": [
[
"0.5"
],
[
0.6
]
]
}
}
],
"numResults": 1
}
}
2022-11-30 07:50:37.983 [WebSocket request #6]
{
"command": "execute",
"sqlText": "ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ',.'"
}
2022-11-30 07:50:37.998 [WebSocket response #6]
{
"status": "ok",
"attributes": {
"numericCharacters": ",."
},
"responseData": {
"results": [
{
"resultType": "rowCount",
"rowCount": 0
}
],
"numResults": 1
}
}
2022-11-30 07:50:38.498 [WebSocket request #7]
{
"command": "execute",
"sqlText": "EXPORT (\nselect cast(0.5 as DECIMAL(2,2)) as DECIMALCOLUMN\n, cast(0.6 as DOUBLE) as DOUBLECOLUMN\nfrom DUAL\n) INTO CSV\nAT 'https://192.168.100.75:45003' FILE '000.csv'\nWITH COLUMN NAMES"
}
2022-11-30 07:50:39.654 [WebSocket response #7]
{
"status": "ok",
"responseData": {
"results": [
{
"resultType": "rowCount",
"rowCount": 1
}
],
"numResults": 1
}
}
2022-11-30 07:50:39.654 [WebSocket request #8]
{
"command": "execute",
"sqlText": "select cast(0.5 as DECIMAL(2,2)) as DECIMALCOLUMN\n, cast(0.6 as DOUBLE) as DOUBLECOLUMN\nfrom DUAL"
}
2022-11-30 07:50:39.670 [WebSocket response #8]
{
"status": "ok",
"responseData": {
"results": [
{
"resultType": "resultSet",
"resultSet": {
"numColumns": 2,
"numRows": 1,
"numRowsInMessage": 1,
"columns": [
{
"name": "DECIMALCOLUMN",
"dataType": {
"type": "DECIMAL",
"precision": 2,
"scale": 2
}
},
{
"name": "DOUBLECOLUMN",
"dataType": {
"type": "DOUBLE"
}
}
],
"data": [
[
"0,5"
],
[
0.6
]
]
}
}
],
"numResults": 1
}
}
2022-11-30 07:50:39.717 [WebSocket request #9]
{
"command": "disconnect"
}
from pyexasol.
Ok, values are actually returned as floats from Exasol Websocket API.
The only reason why it works for pandas is that EXPORT command internally formats all values as strings, so NLS_NUMERIC_CHARACTERS
is applied. It does not happen with normal fetching.
You may define custom fetch_mapper
function to transform values manually.
Example of mapper function: https://github.com/exasol/pyexasol/blob/master/pyexasol/mapper.py#L62-L97
Example which sets mapper function as connection option: https://github.com/exasol/pyexasol/blob/master/examples/a04_fetch_mapper.py#L24
from pyexasol.
I am closing this ticket, since there was no response from the person asking in over a month since the last answer.
from pyexasol.
Related Issues (20)
- Mixed type error message HOT 3
- Support for Polars HOT 29
- 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
- ✨ Make websocket types of dbapi2 compatibilty shim PEP-249 compliant HOT 6
- 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
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.