• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
custom record ID
#1
Is there a way for me to modify the record Id
I already have a database and they have their records Id already. It's a UUID similar to the ones you are using but slightly different.
If I create new records that are not a problem (as these ids are alpha so it does not matter as long as they are unique).
But if I want to use existing records it's another problem.

I can definitively ignore your ids but I think it's a bit of waste.

However, if I can change an id or provide the id when I create a new record it will be OK.

Please let me know...

Best,
  Reply
#2
(09-10-2021, 02:14 PM)philippecoenen Wrote: Is there a way for me to modify the record Id
I already have a database and they have their records Id already. It's a UUID similar to the ones you are using but slightly different.
If I create new records that are not a problem (as these ids are alpha so it does not matter as long as they are unique).
But if I want to use existing records it's another problem.

I can definitively ignore your ids but I think it's a bit of waste.

However, if I can change an id or provide the id when I create a new record it will be OK.

Please let me know...

Best,
Hi Philippe,

You can not change the existing record ID, but you can use your own ID in new records. They must meet the UUID format or the create command will generate an error.

You can export your existing database to either CSV or JSON. Read the data in and massage into an array.
Walk through each record and take your existing ID and place it in a cdbRecordID key. 

While making your array, use the batchCreate API's format.

You can also upload your database one record at a time if that works for you. You would still use your existing ID in the cdbRecordID key to preserve your current ID value.

Let me know if you have any problems.

-Mark
  Reply
#3
(09-10-2021, 04:52 PM)mark_talluto Wrote:
(09-10-2021, 02:14 PM)philippecoenen Wrote: Is there a way for me to modify the record Id
I already have a database and they have their records Id already. It's a UUID similar to the ones you are using but slightly different.
If I create new records that are not a problem (as these ids are alpha so it does not matter as long as they are unique).
But if I want to use existing records it's another problem.

I can definitively ignore your ids but I think it's a bit of waste.

However, if I can change an id or provide the id when I create a new record it will be OK.

Please let me know...

Best,
Hi Philippe,

You can not change the existing record ID, but you can use your own ID in new records. They must meet the UUID format or the create command will generate an error.

You can export your existing database to either CSV or JSON. Read the data in and massage into an array.
Walk through each record and take your existing ID and place it in a cdbRecordID key. 

While making your array, use the batchCreate API's format.

You can also upload your database one record at a time if that works for you. You would still use your existing ID in the cdbRecordID key to preserve your current ID value.

Let me know if you have any problems.

-Mark
Hi Mark,

Thanks for your prompt answer and it's clear.
I'll have to deal with the format of my IDs but that's OK.

So far no problems... However, I'm sure they will come... ;(

But you are there so I feel safe Wink

-Phil
  Reply
#4
Hi Phil,

You are most welcome. Thank you for taking the time to learn CanelaDB and LiveCloud. I am sure you will become a master in no time. You are well on your way. I try to be in the forums every day to answer questions.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)