dbTalk Databases Forums  

AMO - problems with update

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss AMO - problems with update in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Slawomir Zurek
 
Posts: n/a

Default AMO - problems with update - 04-10-2006 , 04:01 AM






Hello,

In my AS2005 database i have got several cubes and dimensions. Now i'm
trying to develop appliacation which helps users made simple enhacements in
this db - especially add attribute to dimension. I'm using AMO.

My scenario :
1).add new table to datasource view -> no problem
2) add new attribute to _database_ dimension -> there I have got problem
with "Update()" call

The problem is updating dimension - im using
Update(UpdateOptions.ExpandFull) but this fail if my dimension is attached
in other cubes, measure grups etc.

so i found and tried to explore ImpactCollection:

XmlaWarningCollection xmlaW;
ImpactDetailCollection impD;
dim.Update(UpdateOptions.ExpandFull, UpdateMode.Default,xmlaW,impD,true);

Now I have got 14 impatc detail objects, but I dont know what to do next.
I'm tried different Update() combination but with no effect.
Could anybody give me a hint what should i do ? My goal is to add this
attribute, so i will be visible everywhere my dimension is attached.

Unfortunately Books Online and MSDN is very poor in AMO objects
documentation (only examples helps me a lot at start).

Greetings
Slawomi Zurek

PS: sorry for my english, but I hope You understand a little ;-)




Reply With Quote
  #2  
Old   
James Lim
 
Posts: n/a

Default RE: AMO - problems with update - 04-10-2006 , 03:57 PM






We have exactly same issue and I escalated it to MS now.
Maybe it is not the same case but the reason what we found is when you
update that APPDEF lost its db connection information if you are using user
id and password to connect source database.

The workaround what I am using is reassign userid and password in appdef but
I already escalated it to MS because we can't add these step whenever we call
update.

I hope it will help you.


"Slawomir Zurek" wrote:

Quote:
Hello,

In my AS2005 database i have got several cubes and dimensions. Now i'm
trying to develop appliacation which helps users made simple enhacements in
this db - especially add attribute to dimension. I'm using AMO.

My scenario :
1).add new table to datasource view -> no problem
2) add new attribute to _database_ dimension -> there I have got problem
with "Update()" call

The problem is updating dimension - im using
Update(UpdateOptions.ExpandFull) but this fail if my dimension is attached
in other cubes, measure grups etc.

so i found and tried to explore ImpactCollection:

XmlaWarningCollection xmlaW;
ImpactDetailCollection impD;
dim.Update(UpdateOptions.ExpandFull, UpdateMode.Default,xmlaW,impD,true);

Now I have got 14 impatc detail objects, but I dont know what to do next.
I'm tried different Update() combination but with no effect.
Could anybody give me a hint what should i do ? My goal is to add this
attribute, so i will be visible everywhere my dimension is attached.

Unfortunately Books Online and MSDN is very poor in AMO objects
documentation (only examples helps me a lot at start).

Greetings
Slawomi Zurek

PS: sorry for my english, but I hope You understand a little ;-)





Reply With Quote
  #3  
Old   
Slawomir Zurek
 
Posts: n/a

Default Re: AMO - problems with update - 04-11-2006 , 03:26 AM




Quote:
We have exactly same issue and I escalated it to MS now.
Maybe it is not the same case but the reason what we found is when you
update that APPDEF lost its db connection information if you are using
user
id and password to connect source database.

The workaround what I am using is reassign userid and password in appdef
but
I already escalated it to MS because we can't add these step whenever we
call
update.

I hope it will help you.
Thanks for answer. To be quite frank, it is not clear for me waht do you
mean by "APPDEF".
Anyway, many other Update() calls works well (i'm creating dimesions,
updating simple properties of cubes,measures etc). In my scenario (adding
attribute to existing and used dimension) Update(UpdateOptions.ExpandFull)
throw exeption about invalidate cubes and measures groups:

"Errors in the metadata manager. The measure group with the ID of 'FKT
Sprzedaz V Distinct L Docelowych', Name of 'FKT Liczba Docelowych' was
invalidated by operations in the transaction.
Errors in the metadata manager. The cube with the ID of 'Wyniki Operacyjne',
Name of 'Wyniki Operacyjne' was invalidated by operations in the
transaction.
Errors in the metadata manager. The measure group with the ID of 'FKT
Sprzedaz', Name of 'FKT Sprzedaz' was invalidated by operations in the
transaction.
<......>
Errors in the metadata manager. The transaction cannot be committed because
one or more objects were invalidated during the transaction."

I think this behaviour is "by design", because when I did same operation in
BI Developement Studio, and click SAVE (not "Save all") i got same error.
Everything works well when i click "Save All" - so in fact my question
shuold be: "What the hell do Save All in BIDS ?". I suspect some action on
ImpactDetailCollection, but i have no idea how to propery use its
information.

Slawek





Reply With Quote
  #4  
Old   
Akshai Mirchandani [MS]
 
Posts: n/a

Default Re: AMO - problems with update - 04-11-2006 , 03:22 PM



All "affected" objects need to be altered (updated) in the same
transaction -- so essentially:

Begin Transaction
Alter Dimension
Dimension.Update
Call Update on all affected objects
Commit Transaction

Thanks,
Akshai
--
This posting is provided "AS IS" with no warranties, and confers no rights
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

"Slawomir Zurek" <slawomir.zurek (AT) HATESPAMpoczta (DOT) fm> wrote

Quote:
We have exactly same issue and I escalated it to MS now.
Maybe it is not the same case but the reason what we found is when you
update that APPDEF lost its db connection information if you are using
user
id and password to connect source database.

The workaround what I am using is reassign userid and password in appdef
but
I already escalated it to MS because we can't add these step whenever we
call
update.

I hope it will help you.

Thanks for answer. To be quite frank, it is not clear for me waht do you
mean by "APPDEF".
Anyway, many other Update() calls works well (i'm creating dimesions,
updating simple properties of cubes,measures etc). In my scenario (adding
attribute to existing and used dimension) Update(UpdateOptions.ExpandFull)
throw exeption about invalidate cubes and measures groups:

"Errors in the metadata manager. The measure group with the ID of 'FKT
Sprzedaz V Distinct L Docelowych', Name of 'FKT Liczba Docelowych' was
invalidated by operations in the transaction.
Errors in the metadata manager. The cube with the ID of 'Wyniki
Operacyjne', Name of 'Wyniki Operacyjne' was invalidated by operations in
the transaction.
Errors in the metadata manager. The measure group with the ID of 'FKT
Sprzedaz', Name of 'FKT Sprzedaz' was invalidated by operations in the
transaction.
......
Errors in the metadata manager. The transaction cannot be committed
because one or more objects were invalidated during the transaction."

I think this behaviour is "by design", because when I did same operation
in BI Developement Studio, and click SAVE (not "Save all") i got same
error. Everything works well when i click "Save All" - so in fact my
question shuold be: "What the hell do Save All in BIDS ?". I suspect some
action on ImpactDetailCollection, but i have no idea how to propery use
its information.

Slawek






Reply With Quote
  #5  
Old   
Slawomir Zurek
 
Posts: n/a

Default Re: AMO - problems with update - 04-12-2006 , 03:42 AM



Quote:
All "affected" objects need to be altered (updated) in the same
transaction -- so essentially:

Begin Transaction
Alter Dimension
Dimension.Update
Call Update on all affected objects
Commit Transaction

Thanks,
Akshai
--
Thanks Akshai!
My first implemenation was similar to Your answer, but i made some mistakes,
and finally go wrong way. Now I manage to Update() my database correctly
after adding my new atrribute. But now this is "working solution" which is
far, far away form "best/optimized" solution
So, please let me ask You some more questions, so I could "organize" just
collected knowledge:

1. How to get "affected" objects - I noticed, that after BeginTransaction i
cannot call Update() with ImpactAnalysis Options. So I think, i should use
one of following method:
- call Update() with Impact onlly analysis on unchanged dimension to get
collection of all affected object in ImpactAnalysis (Is it proper/possible
?)
- loop through all my AS database looking for dependent objects
- use some other method of AMO object ;-)

2. How deep should be update of "affected" objects - after altering some
object , should I Update() affected objects to the lowest possible level (in
my case - after alternig database dimension will be enough to call Update()
on Cubes or should I call Update() on Measure Groups too) ?
Furthermore, if i already got collection of affected object is there
"simple" ;-) method to arrange them in correct order for Update (e.g Cubes
before Measures Group etc, etc), or have I to implement this by hand ?

3. Most important - ary You planning to release some better documentation of
AMO ? Current help (I use BOL - december 2005) contents do not help me very
much (most of desciption is "Thread Safety" and "Platforms" paragraphs
;-) ))

Of course I will make some test to figure out how it works, but I will be
very thankful for any answer.

Slawek




Reply With Quote
  #6  
Old   
Adrian Dumitrascu [MS]
 
Posts: n/a

Default Re: AMO - problems with update - 04-12-2006 , 04:57 PM



To save structural changes to an object (like the attribute addition to a
dimension in this case), you can use the .Update method with the
UpdateOptions.AlterDependents parameter:

myDimension.Update(UpdateOptions.AlterDependents);

This method will run impact analysis to detect the dependents requiring
update and, in the end, will save all of them an once (transactional batch).

Impact analysis has indeed the limitation you noticed, you cannot use it
inside a transaction. But you can start the transaction after you got the
list of dependents from impact analysis, however I hope you no longer need
to do that since the .Update(UpdateOptions.AlterDependents) should do what
you want.

Adrian.



"Slawomir Zurek" <slawomir.zurek (AT) HATESPAMpoczta (DOT) fm> wrote

Quote:
All "affected" objects need to be altered (updated) in the same
transaction -- so essentially:

Begin Transaction
Alter Dimension
Dimension.Update
Call Update on all affected objects
Commit Transaction

Thanks,
Akshai
--

Thanks Akshai!
My first implemenation was similar to Your answer, but i made some
mistakes, and finally go wrong way. Now I manage to Update() my database
correctly after adding my new atrribute. But now this is "working
solution" which is far, far away form "best/optimized" solution
So, please let me ask You some more questions, so I could "organize" just
collected knowledge:

1. How to get "affected" objects - I noticed, that after BeginTransaction
i cannot call Update() with ImpactAnalysis Options. So I think, i should
use one of following method:
- call Update() with Impact onlly analysis on unchanged dimension to
get collection of all affected object in ImpactAnalysis (Is it
proper/possible ?)
- loop through all my AS database looking for dependent objects
- use some other method of AMO object ;-)

2. How deep should be update of "affected" objects - after altering some
object , should I Update() affected objects to the lowest possible level
(in my case - after alternig database dimension will be enough to call
Update() on Cubes or should I call Update() on Measure Groups too) ?
Furthermore, if i already got collection of affected object is there
"simple" ;-) method to arrange them in correct order for Update (e.g Cubes
before Measures Group etc, etc), or have I to implement this by hand ?

3. Most important - ary You planning to release some better documentation
of AMO ? Current help (I use BOL - december 2005) contents do not help me
very much (most of desciption is "Thread Safety" and "Platforms"
paragraphs ;-) ))

Of course I will make some test to figure out how it works, but I will be
very thankful for any answer.

Slawek




Reply With Quote
  #7  
Old   
Slawomir Zurek
 
Posts: n/a

Default Re: AMO - problems with update - 04-13-2006 , 03:16 AM



Thanks again,
I noticed that working on base AMO object is quite simple (as in Your post
below) when you add attribute to unbound dimension
Anyway, with Your help I manged with that (and learned a bit).

Worse thing, is that i came to another "wall", but I will start new thread
on it. Hope You are not sick of my questions...
Slawek


Użytkownik "Adrian Dumitrascu [MS]" <adriandu (AT) microsoft (DOT) com> napisał w
wiadomości news:e71LdwnXGHA.3448 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
Quote:
To save structural changes to an object (like the attribute addition to a
dimension in this case), you can use the .Update method with the
UpdateOptions.AlterDependents parameter:

myDimension.Update(UpdateOptions.AlterDependents);

This method will run impact analysis to detect the dependents requiring
update and, in the end, will save all of them an once (transactional
batch).

Impact analysis has indeed the limitation you noticed, you cannot use it
inside a transaction. But you can start the transaction after you got the
list of dependents from impact analysis, however I hope you no longer need
to do that since the .Update(UpdateOptions.AlterDependents) should do what
you want.

Adrian.



"Slawomir Zurek" <slawomir.zurek (AT) HATESPAMpoczta (DOT) fm> wrote in message
news:e1ie43$j1s$1 (AT) news (DOT) interia.pl...
.....
<...cut..>
.....




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.