The Table Column Info displayed in the Format tab of the Import Dialog is populated by using the metadata of the table. For MongoDB, (1) the metadata is generated by using the first document in the collection and (2) each record can have a different structure. The user may want to import records that are different than the current metadata structure. The Format tab should be enhanced to allow the user to update the Column Name and Data Type info so that the data can be mapped to different columns.
Currently, the Table Column Info section of the Format tab doesn't allow any changes. For MongoDB, this section should be editable. Populate it with the existing metadata structure of the collection and add an empty row at the end. The user can update this empty row to map a column. When this empty row has been updated, add another empty row at the end. This is similar to how the General tab of the Alter Table dialog works.
Hi Jenny,
I discussed with Sachin, we will make the Column Name and Data Type columns editable but not add additional rows initially. This is done and checked in as SVN r32440. Please review r32440. In particular, the following two items:
(1) ColumnInfoModel::setValueAt(Object, int, int)
In this method, I need to update both AFTableColumn._mdDateType and AFTableColumn._dataType. Please see comments in that method for more info.
(2) ImportThread::generateCollectionInsert(ETLFileRecord, ...)
A row retrieved from the Column Info Table is skipped if user modified that row and left either the Column Name cell or the Data Type cell blank.
In addition, while testing r32440, I noticed that an SQL statement similar to the one shown below can be generated by ImportThread::generateCollectionInsert(ETLFileRecord, ...):
"INSERT INTO baseball() VALUES()"
This does not seem to be a valid Mongo SQL, executing this SQL in query analyzer generates this error:
Syntax error on input SQL `INSERT INTO baseball()
VALUES()`: •The INSERT statement requires at least one input document.
This has nothing to do with item #2 above and can be reproduced without modifying table column definitions; it has something to do with 'columnObject' (line #1247) which is skipped in the for loop if it is null. You might want to take a look.
Hi Jenny,
I discussed with Sachin, we will make the Column Name and Data Type columns editable but not add additional rows initially. This is done and checked in as SVN r32440. Please review r32440. In particular, the following two items:
(1) ColumnInfoModel::setValueAt(Object, int, int)
In this method, I need to update both AFTableColumn._mdDateType and AFTableColumn._dataType. Please see comments in that method for more info.
(2) ImportThread::generateCollectionInsert(ETLFileRecord, ...)
A row retrieved from the Column Info Table is skipped if user modified that row and left either the Column Name cell or the Data Type cell blank.
In addition, while testing r32440, I noticed that an SQL statement similar to the one shown below can be generated by ImportThread::generateCollectionInsert(ETLFileRecord, ...):
"INSERT INTO baseball() VALUES()"
This does not seem to be a valid Mongo SQL, executing this SQL in query analyzer generates this error:
Syntax error on input SQL `INSERT INTO baseball()
VALUES()`: •The INSERT statement requires at least one input document.
This has nothing to do with item #2 above and can be reproduced without modifying table column definitions; it has something to do with 'columnObject' (line #1247) which is skipped in the for loop if it is null. You might want to take a look.
I am able to reproduce the empty INSERT statement generated by the Import Tool. However, it is not specific to MongoDB. It is also generated for other database servers.
The MongoJDBC driver can now handle the empty INSERT statement.
I am able to reproduce the empty INSERT statement generated by the Import Tool. However, it is not specific to MongoDB. It is also generated for other database servers.
The MongoJDBC driver can now handle the empty INSERT statement.
Issue #8585 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build ADS 14.0.0-alpha-16 (mongo-jdbc 1.1.6) |
No time estimate |
1 issue link |
relates to #8820
Issue #8820inconsistent behavior of import data feature of ADS |
Currently, the Table Column Info section of the Format tab doesn't allow any changes. For MongoDB, this section should be editable. Populate it with the existing metadata structure of the collection and add an empty row at the end. The user can update this empty row to map a column. When this empty row has been updated, add another empty row at the end. This is similar to how the General tab of the Alter Table dialog works.