talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

ID Service - how to set the current value

CP
Christopher Pott
Thu, Mar 7, 2013 12:41 PM

Hi,

I'm working on a requirement to implement our ID number patterns, and to configure ID number generation so that it begins after the last imported record (so if we've imported 526 movement records the ID generation begins at MV2013.527). To save time during import I'm not using the ID generator service to fetch IDs for all imported records, I'm generating them in my import scripts - so the ID service doesn't 'know' what number we've reached. So this is my question: how do I inform the ID generator of the current ID?

My first plan was to use the ID Service API. There is no update (PUT) functionality on this service, so I thought I could create the ID generators after import and set the current values in the same request. However, I've tried the ID Service API and it seems that while it's possible to use the API to create a new ID Generator, the displayname, description and last_generated_id will always be null (and I'm assuming last_generated_id is the value I need to set).

My current idea is to create my ID generators by just editing the sql describing the default generators, and then manually update the database with all the "last_generated_id"s after import, but I just wanted to check first if anyone knew of a "better" way.

Cheers,
Chris

Hi, I'm working on a requirement to implement our ID number patterns, and to configure ID number generation so that it begins after the last imported record (so if we've imported 526 movement records the ID generation begins at MV2013.527). To save time during import I'm not using the ID generator service to fetch IDs for all imported records, I'm generating them in my import scripts - so the ID service doesn't 'know' what number we've reached. So this is my question: how do I inform the ID generator of the current ID? My first plan was to use the ID Service API. There is no update (PUT) functionality on this service, so I thought I could create the ID generators after import and set the current values in the same request. However, I've tried the ID Service API and it seems that while it's possible to use the API to create a new ID Generator, the displayname, description and last_generated_id will always be null (and I'm assuming last_generated_id is the value I need to set). My current idea is to create my ID generators by just editing the sql describing the default generators, and then manually update the database with all the "last_generated_id"s after import, but I just wanted to check first if anyone knew of a "better" way. Cheers, Chris
AR
Aron Roberts
Thu, Mar 7, 2013 5:01 PM

My current idea is to create my ID generators by just editing the sql describing the default generators, and then manually update the database with all the “last_generated_id”s after import, but I just wanted to check first if anyone knew of a “better” way.

That sounds like a good approach, Chris - the best I know of, given
the limitations of the ID service that you've (AFAIK correctly)
identified.

One thing to keep in mind, while recognizing that it's been a long
time since I've looked at this service, and this is from memory
(only): the 'last_generated_ids' might be read-only.  Instead, you
might need to edit the current value of the particular 'part' of the
ID that should auto-increment.  If that's too terse, just let me know
and I can give an example.

Aron

On Thu, Mar 7, 2013 at 4:41 AM, Christopher Pott
Christopher.Pott@smk.dk wrote:

Hi,

I’m working on a requirement to implement our ID number patterns, and to
configure ID number generation so that it begins after the last imported
record (so if we’ve imported 526 movement records the ID generation begins
at MV2013.527). To save time during import I’m not using the ID generator
service to fetch IDs for all imported records, I’m generating them in my
import scripts - so the ID service doesn’t ‘know’ what number we’ve reached.
So this is my question: how do I inform the ID generator of the current ID?

My first plan was to use the ID Service API. There is no update (PUT)
functionality on this service, so I thought I could create the ID generators
after import and set the current values in the same request. However, I’ve
tried the ID Service API and it seems that while it’s possible to use the
API to create a new ID Generator, the displayname, description and
last_generated_id will always be null (and I’m assuming last_generated_id is
the value I need to set).

My current idea is to create my ID generators by just editing the sql
describing the default generators, and then manually update the database
with all the “last_generated_id”s after import, but I just wanted to check
first if anyone knew of a “better” way.

Cheers,

Chris


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org

> My current idea is to create my ID generators by just editing the sql describing the default generators, and then manually update the database with all the “last_generated_id”s after import, but I just wanted to check first if anyone knew of a “better” way. That sounds like a good approach, Chris - the best I know of, given the limitations of the ID service that you've (AFAIK correctly) identified. One thing to keep in mind, while recognizing that it's been a long time since I've looked at this service, and this is from memory (only): the 'last_generated_ids' *might* be read-only. Instead, you *might* need to edit the current value of the particular 'part' of the ID that should auto-increment. If that's too terse, just let me know and I can give an example. Aron On Thu, Mar 7, 2013 at 4:41 AM, Christopher Pott <Christopher.Pott@smk.dk> wrote: > Hi, > > > > I’m working on a requirement to implement our ID number patterns, and to > configure ID number generation so that it begins after the last imported > record (so if we’ve imported 526 movement records the ID generation begins > at MV2013.527). To save time during import I’m not using the ID generator > service to fetch IDs for all imported records, I’m generating them in my > import scripts - so the ID service doesn’t ‘know’ what number we’ve reached. > So this is my question: how do I inform the ID generator of the current ID? > > > > My first plan was to use the ID Service API. There is no update (PUT) > functionality on this service, so I thought I could create the ID generators > after import and set the current values in the same request. However, I’ve > tried the ID Service API and it seems that while it’s possible to use the > API to create a new ID Generator, the displayname, description and > last_generated_id will always be null (and I’m assuming last_generated_id is > the value I need to set). > > > > My current idea is to create my ID generators by just editing the sql > describing the default generators, and then manually update the database > with all the “last_generated_id”s after import, but I just wanted to check > first if anyone knew of a “better” way. > > > > Cheers, > > Chris > > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >
PS
Patrick Schmitz
Thu, Mar 7, 2013 5:15 PM

This seems like a common use-case. Aron, can you please create a JIRA to
provide at least a services call for this, if not an admin web-app to list
and administer these?

Thanks - Patrick

-----Original Message-----
From: Talk [mailto:talk-bounces@lists.collectionspace.org] On Behalf Of
Aron Roberts
Sent: Thursday, March 07, 2013 9:01 AM
To: Christopher Pott
Cc: talk@lists.collectionspace.org
Subject: Re: [Talk] ID Service - how to set the current value

My current idea is to create my ID generators by just editing the sql

describing the default generators, and then manually update the database
with all the "last_generated_id"s after import, but I just wanted to

check

first if anyone knew of a "better" way.

That sounds like a good approach, Chris - the best I know of, given the
limitations of the ID service that you've (AFAIK correctly) identified.

One thing to keep in mind, while recognizing that it's been a long time

since

I've looked at this service, and this is from memory
(only): the 'last_generated_ids' might be read-only.  Instead, you
might need to edit the current value of the particular 'part' of the

ID that

should auto-increment.  If that's too terse, just let me know and I can

give

an example.

Aron

On Thu, Mar 7, 2013 at 4:41 AM, Christopher Pott
Christopher.Pott@smk.dk wrote:

Hi,

I'm working on a requirement to implement our ID number patterns, and
to configure ID number generation so that it begins after the last
imported record (so if we've imported 526 movement records the ID
generation begins at MV2013.527). To save time during import I'm not
using the ID generator service to fetch IDs for all imported records,
I'm generating them in my import scripts - so the ID service doesn't

'know'

what number we've reached.

So this is my question: how do I inform the ID generator of the

current ID?

My first plan was to use the ID Service API. There is no update (PUT)
functionality on this service, so I thought I could create the ID
generators after import and set the current values in the same
request. However, I've tried the ID Service API and it seems that
while it's possible to use the API to create a new ID Generator, the
displayname, description and last_generated_id will always be null
(and I'm assuming last_generated_id is the value I need to set).

My current idea is to create my ID generators by just editing the sql
describing the default generators, and then manually update the
database with all the "last_generated_id"s after import, but I just
wanted to check first if anyone knew of a "better" way.

Cheers,

Chris


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectio
nspace.org


Talk mailing list
Talk@lists.collectionspace.org

org

This seems like a common use-case. Aron, can you please create a JIRA to provide at least a services call for this, if not an admin web-app to list and administer these? Thanks - Patrick > -----Original Message----- > From: Talk [mailto:talk-bounces@lists.collectionspace.org] On Behalf Of > Aron Roberts > Sent: Thursday, March 07, 2013 9:01 AM > To: Christopher Pott > Cc: talk@lists.collectionspace.org > Subject: Re: [Talk] ID Service - how to set the current value > > > My current idea is to create my ID generators by just editing the sql > describing the default generators, and then manually update the database > with all the "last_generated_id"s after import, but I just wanted to check > first if anyone knew of a "better" way. > > That sounds like a good approach, Chris - the best I know of, given the > limitations of the ID service that you've (AFAIK correctly) identified. > > One thing to keep in mind, while recognizing that it's been a long time since > I've looked at this service, and this is from memory > (only): the 'last_generated_ids' *might* be read-only. Instead, you > *might* need to edit the current value of the particular 'part' of the ID that > should auto-increment. If that's too terse, just let me know and I can give > an example. > > Aron > > On Thu, Mar 7, 2013 at 4:41 AM, Christopher Pott > <Christopher.Pott@smk.dk> wrote: > > Hi, > > > > > > > > I'm working on a requirement to implement our ID number patterns, and > > to configure ID number generation so that it begins after the last > > imported record (so if we've imported 526 movement records the ID > > generation begins at MV2013.527). To save time during import I'm not > > using the ID generator service to fetch IDs for all imported records, > > I'm generating them in my import scripts - so the ID service doesn't 'know' > what number we've reached. > > So this is my question: how do I inform the ID generator of the current ID? > > > > > > > > My first plan was to use the ID Service API. There is no update (PUT) > > functionality on this service, so I thought I could create the ID > > generators after import and set the current values in the same > > request. However, I've tried the ID Service API and it seems that > > while it's possible to use the API to create a new ID Generator, the > > displayname, description and last_generated_id will always be null > > (and I'm assuming last_generated_id is the value I need to set). > > > > > > > > My current idea is to create my ID generators by just editing the sql > > describing the default generators, and then manually update the > > database with all the "last_generated_id"s after import, but I just > > wanted to check first if anyone knew of a "better" way. > > > > > > > > Cheers, > > > > Chris > > > > > > _______________________________________________ > > Talk mailing list > > Talk@lists.collectionspace.org > > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectio > > nspace.org > > > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspa ce. > org