cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Have you tried to use SQL scripts to move WTParts from one Library Context to another one?

dtkach1
1-Newbie

Have you tried to use SQL scripts to move WTParts from one Library Context to another one?

Just interesting to check out if anyobody tried to use SQL scripts to move WTParts from one Library Context to another one and after the moving is done to delete the old Library Context.

D
14 REPLIES 14
ddemay
1-Newbie
(To:dtkach1)

This is doable with SQL but the administrative domain also has to be dealt with along with subfolder object identifiers.

It moved, but onetime I did this, one part stayed behind in old container, didn't investigate it.

If I had to choose, I would do this with java.


Sent from my Verizon Wireless BlackBerry
avillanueva
22-Sapphire I
(To:dtkach1)

Agreed, use the API or UI to do moves. How many parts do you have to
move?


The Administrative domain has to deal with it because of the ACLs are
defined against it or because of some other reason?

thanks,
Dmitry

I would say that we are investigating SQL option of moving parts . Even
if write a java code we still need to identify how we can test solution
that Windchill will be not broken.

D

Even though it may be possible to use SQL, I recommend using the API,
Recently we have moved lots of items (Documents) from couple of Contexts
(Libraries) to multiple contexts using the API. The whole thing went
smooth except for the items that are checked out.



My only complaint is about the moving items in bulk (using collections).
If you use them, you could gain lot of efficiencies but even if one
fails, it rolls back all of the items that are being moved in the
collection.



Raju Pulavarthi

St. Jude Medical
avillanueva
22-Sapphire I
(To:dtkach1)

If you have access to the codebase locally, you can write a Java client
that will do the work of the move. You can feed it a list of numbers
(that you can get from SQL) and have it churn away. Not posting code to
the server and rebooting. Using the API should not break Windchill. I
use them a lot for renames or set states where I have a list of parts.


What about the Change Objects that were created against the library
context? What will be the procedure to move Change Objects
(PRs/CRs/CNs/CAs) to another Library Context?

The move API should be able to handle the Change Objects as well.



Raju Pulavarthi

St. Jude Medical

I mean using SQL not a java API. I think I just lazy to turn on logging
debug info to trace SQL that is executed during Move action from PDMLink
interface.
Just want to check if anybody used SQL for it (the use of QuerySpec
should be the same as SQL)
ddemay
1-Newbie
(To:dtkach1)


Eventually it all goes to some kind of SQL, just not sure why you would want to use it, even with the verbosities enabled. When I used SQL, I left out the fact that I used info from same folder and same object type in the destination container.

I did this for the sake of time and it was a development server, so the data didn't matter.

I would use Java on a production server.

David
Sent from my Verizon Wireless BlackBerry
jessh
5-Regular Member
(To:dtkach1)

If using a given SQL recipe works today it may well not work tomorrow
-- it's a fragile approach in which it is easy to miss something (e.g.
when the case you traced does not contain all the different data cases
for starters) and really mess up your data.

Going behind the API and modifying data directly with SQL is not
supported for just such reasons. The supported approach is to use the API.

--
Jess Holle


So Windchill API are supported. Does it mean that if we have issues
after running these APIs PTC tech support will help us to fix it ?


With verbosity enabled we can see the final SQL that was generated from
Persistence API. So we can see the relationships/dependencies between
the tables. Again there is no documentation that explain how Tables are
linked together and if you updating one table what other tables have to
update as well. At least this is my understanding. Of course I can be
wrong.

Thanks,
Dmitry
ddemay
1-Newbie
(To:dtkach1)

Yes if the API says "supported API true" in javadocs.

Otherwise, no.

And yes, SQL or Java, you have to test your logic first.

Besides I think move is in EnterpriseHelper or something like it. (Not at my computer right now) Building your collection of parts is the logic you would have to write.


Sent from my Verizon Wireless BlackBerry
Top Tags