Mappings don't work with UDT's

18 views
Skip to first unread message

Rohan Doshi

unread,
Aug 28, 2019, 1:44:33 AM8/28/19
to DataStax Node.js Driver for Apache Cassandra Mailing List
Hi,

I have a UDT column where I am using the UnderscoreSqlToCamelCaseMapping to convert it to correct column names.
The mappings works correctly on the column names but has issues converting the UDT keys to underscore.

Mapper config:

this.mapper = new Cassandra.mapping.Mapper(this.client, {
 models
: {
 
'Posts': {
        tables
: ['account_posts'],
        mappings
: new UnderscoreCqlToCamelCaseMappings()
     
},
...}



The data I wanted to store looks something like:
{
   "postsData":[
      {
         "postUrl":"url",
         "postedOn":123432
      }
   ]
}

The data for the same column in cassandra looks like [{"post_url":null,"posted_on":null}]

The mappers works correctly if the values for the column are anything but UDT's.
I couldn't find any specific config for UDT mappers or any examples online for the same.

Any help is appreciated.

Thanks,
Rohan

Jorge Bay Gondra

unread,
Aug 28, 2019, 4:35:03 AM8/28/19
to nodejs-dr...@lists.datastax.com
Hi Rohan,
The Mapper doesn't support UDT field mappings yet, I've created a ticket for it: NODEJS-542.

Thanks,
Jorge

--
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-u...@lists.datastax.com.

Rohan Doshi

unread,
Aug 28, 2019, 6:34:10 AM8/28/19
to nodejs-dr...@lists.datastax.com
Hi Jorge,

Thanks for the quick response. Really appreciate it.

Is there a way where I can also contribute to this driver ?
Maybe start on the easy fixes for the project or something?

Thanks,
Rohan Doshi

Jorge Bay Gondra

unread,
Aug 28, 2019, 6:47:50 AM8/28/19
to nodejs-dr...@lists.datastax.com
Sure, contributions are always welcome!

We use JIRA as issue tracker, its not a very comfortable UI but its what we have :)


Tickets related to the Mapper are a good place to start, as the Mapper is relatively new component of the driver and it doesn't require you to learn the whole codebase beforehand. For example, you can look at NODEJS-538.

Feel free to send a pull request on github for any ticket or create your own ticket. If a feature/bug requires deep changes in the driver, it's a good idea to discuss it on the ticket before implementing it.

Thanks,
Jorge
Reply all
Reply to author
Forward
0 new messages