[MDEV-17212] Connect Engine ODBC Table_Type - Discovery Process Created: 2018-09-17 Updated: 2018-11-21 Resolved: 2018-10-15 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.3.9 |
| Fix Version/s: | 10.0.37, 10.3.11, 10.1.37, 10.2.19 |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Juan Telleria | Assignee: | Olivier Bertrand |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows |
||
| Attachments: |
|
| Description |
|
Some minor issues when using MariaDB's Connect ODBC Table_Type Engine with Microsoft Parallel Data Warehouse (PDW): table_options: TABNAMEWhen using a Table Definition such as the following for importing a Table:
The Query works perfectly (10/10), and I am able to import my tables easily to MariaDB. However, an observed limitation is that in TABNAME option, I can only specify my table as:
table_options: SRCDEFWith Microsoft PDW, using "SQL Server Native Client 11.0" it is not possible to use SRCDEF table option, as otherwise, we would obtain error: "SQLNumResultCols: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Cursor support is not an implemented feature for SQL Server Parallel DataWarehousing TDS endpoint". This limitation could be avoided with first method, but we are not able create table definitions as the following by means of the Table Discovery Process:
Previous Table definition would only work if we specified manually the Column Definitions. Datetime Field PrecissionAnother issue is Datetime Precission (CONNECT Data Types), which can also be handled with querys such as:
Although a little verbose, works. So:
|
| Comments |
| Comment by Olivier Bertrand [ 2018-09-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
1: Accepting brackets is probably specific to some data source. For instance, this syntax is not accepted by PostgreSQL. Even in some case the database or schema can be specified in the table name, this is not recommended and is also dependant on the data source. For instance:
This does not work because the DSN was specified to use the public database and PosgreSQL does not implement references between databases. Therefore the database should be specified in the connection string:
This works alright. Note also that in the connection string the database name can include blanks, which solves problem 1. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Juan Telleria [ 2018-09-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
1. "Note also that in the connection string the database name can include blanks, which solves problem 1.": Perfect. Solved. 2. Still get Error "SQLNumResultCols: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Cursor support is not an implemented feature for SQL Server Parallel DataWarehousing TDS endpoint". Microsft Parallel Data Warehouse is a special multi-cluster Version of SQL Server, that seems not to support cursors. This Query Fails:
But this works:
3. The Remote Table has a Single Column of Type "Datetime" or "TimeStamp", but I specify it at the Local Table as Character:
And by doing this I do not loose precision, at cost of more column bytes in the Connect Table, and not being able to use MariaDB Datetime Functions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2018-09-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
2: Indeed SQLNumResultCols is used inside the discovery process. It is used only to check that the SQLColumns function returned the expected number of columns. Perhaps we could ignore this error. Note that this is the only data source that does not implement that function which, by the way, is not related with cursors. Note also that in these statements the SRCDEF is meaningless and equivalent to specifying the external table name. 3: Well done. Because the MariaDB data type TIMESTAMP does not include the precision, the STR_TO_DATE function does it. This is not related to the CONNECT engine. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Juan Telleria [ 2018-09-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
2. Thank you. 3. But I have to use such approach not only for a matter of precision, but also from range:
And with only some small temporary size overhead! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2018-09-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
FYI: CONNECT also uses a 4 bytes signed integer for dates and handles negative values allowing dates to start around 1902. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Juan Telleria [ 2018-09-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
3. In C++ 11, we can also have data type "long long int", which ranges:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2018-09-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have made the call to SQLNumResultCols conditional. Please test whether it solve problem 2. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Juan Telleria [ 2018-09-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
(3) Ok, thank you: So this shall be included in "Connect 1.06.0006" when released I guess. Than you! (2) On the other hand, and as regards dates, it has been concluded that it will remain as is. So when dealing with MariaDB DATE, DATETIME fields, the best approach will continue to be treating dates as Characters in range: '2038-01-19 03:14:07' to '9999-12-31 23:59:59'. Thank you for all your help! Juan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2018-10-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What is done is testing the implementation by the data source of the function that was causing a crash when not implemented. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Juan Telleria [ 2018-10-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you for the Fix. I attached the PDF Documents of Connect Engine Handler to the MariaDB Knowledge base Article: https://mariadb.com/kb/en/library/using-connect-written-documentation/ Hope others find them useful In addition, on the MariaDB github repository, where is the Connect Internal Data Types Definition located? E.g: TYPE_STRING, TYPE_INT, TYPE_DATE, ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Juan Telleria [ 2018-10-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Seems to be on: But cannot find the specific file... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2018-10-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In global.h | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Juan Telleria [ 2018-11-21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Does the already released MariaDB 10.3.11 implement the fix? Or will we have to wait till 10.3.12? I think the commit has already been pushed... But not sure. Thank you! Juan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2018-11-21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It's hard to tell. I'm not the one who includes updates in new releases and sometimes CONNECT was forgotten. |