dbTalk Databases Forums  

Get last partition name

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


Discuss Get last partition name in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ramunas Balukonis
 
Posts: n/a

Default Get last partition name - 11-28-2006 , 03:29 AM






Hi,

My nigthly job should process last partition. I use AMO object model
Server.Execute method. But how to known the last partition ID? Now I use

AmoServer.Databases("db_id").Cubes("cube ID").MeasureGroups("Measure Group
ID").Partitions(NumberOfPartitions - 1).ID

but this method returns not the last partition in my measure group, but the
last created partition. I mean if I have partitions slst_2005, slst_2006 and
then created slst_2002, slst_2003, slst_2004, so this method will return
slts_2004. I would like to get the slst_2006 one. Of course, i can
programically do a loop through measure group partitions and take partition
with max name. But I hope there are more elegant way. Any suggestions? May I
could make select from analysis services repository in some way??

Ramunas




Reply With Quote
  #2  
Old   
Vimas
 
Posts: n/a

Default Re: Get last partition name - 11-29-2006 , 11:54 AM






I had a similar problem, but I choose to resolve it different way.
I basically maintain a list of SSAS partitions in SQL Server table. I also
have a flag on each partition if it has to be processed or no.
Then I have SSIS package that creates new partitions in SSAS and drops non
existing partitions from SSAS based on records in that table.
After that my SSIS package process all partitions that have required
processing flag to 1 and then resets flag to 0.
My DW load SSIS package changes partition required processing flag to 1 for
partitions that requires to be reporcessed after re-load. Also special
routine creates/drops records from this table when required.Altough it might
sound complicated, it is not really.
This is just an idea as nobody else replied to your original problem.


Regards,



"Ramunas Balukonis" <ramblk2 (AT) hotmail (DOT) com> wrote

Quote:
Hi,

My nigthly job should process last partition. I use AMO object model
Server.Execute method. But how to known the last partition ID? Now I use

AmoServer.Databases("db_id").Cubes("cube ID").MeasureGroups("Measure Group
ID").Partitions(NumberOfPartitions - 1).ID

but this method returns not the last partition in my measure group, but
the
last created partition. I mean if I have partitions slst_2005, slst_2006
and
then created slst_2002, slst_2003, slst_2004, so this method will return
slts_2004. I would like to get the slst_2006 one. Of course, i can
programically do a loop through measure group partitions and take
partition
with max name. But I hope there are more elegant way. Any suggestions? May
I
could make select from analysis services repository in some way??

Ramunas






Reply With Quote
  #3  
Old   
Ramunas Balukonis
 
Posts: n/a

Default Re: Get last partition name - 11-30-2006 , 05:34 AM



Hi, Vimas,
thanks, but it seems a bit comlicated. But I think SSAS stores metada in
some repository and I believe that I could select data directly.

Ramunas


"Vimas" <Vimas (AT) nospam (DOT) nospam> wrote

Quote:
I had a similar problem, but I choose to resolve it different way.
I basically maintain a list of SSAS partitions in SQL Server table. I also
have a flag on each partition if it has to be processed or no.
Then I have SSIS package that creates new partitions in SSAS and drops non
existing partitions from SSAS based on records in that table.
After that my SSIS package process all partitions that have required
processing flag to 1 and then resets flag to 0.
My DW load SSIS package changes partition required processing flag to 1
for
partitions that requires to be reporcessed after re-load. Also special
routine creates/drops records from this table when required.Altough it
might
sound complicated, it is not really.
This is just an idea as nobody else replied to your original problem.


Regards,



"Ramunas Balukonis" <ramblk2 (AT) hotmail (DOT) com> wrote in message
news:1164706163.513596 (AT) loger (DOT) vpmarket.int...
Hi,

My nigthly job should process last partition. I use AMO object model
Server.Execute method. But how to known the last partition ID? Now I
use

AmoServer.Databases("db_id").Cubes("cube ID").MeasureGroups("Measure
Group
ID").Partitions(NumberOfPartitions - 1).ID

but this method returns not the last partition in my measure group, but
the
last created partition. I mean if I have partitions slst_2005, slst_2006
and
then created slst_2002, slst_2003, slst_2004, so this method will return
slts_2004. I would like to get the slst_2006 one. Of course, i can
programically do a loop through measure group partitions and take
partition
with max name. But I hope there are more elegant way. Any suggestions?
May
I
could make select from analysis services repository in some way??

Ramunas








Reply With Quote
  #4  
Old   
yongli
 
Posts: n/a

Default Re: Get last partition name - 12-02-2006 , 03:09 PM



Hi Ramunas,

It makes sense for the SSAS to return the partiton in the order of creation.
There can be only one order to store the partitions, so the SSAS chooses the
natural way to put the partititons into its collection in the order of when
it was created. In order to get your last partition, you can retrieve the
whole partition list and sort them by the the descending order, then the
first in the list is your last partition.

"Ramunas Balukonis" wrote:

Quote:
Hi, Vimas,
thanks, but it seems a bit comlicated. But I think SSAS stores metada in
some repository and I believe that I could select data directly.

Ramunas


"Vimas" <Vimas (AT) nospam (DOT) nospam> wrote in message
news:ei17w99EHHA.4108 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I had a similar problem, but I choose to resolve it different way.
I basically maintain a list of SSAS partitions in SQL Server table. I also
have a flag on each partition if it has to be processed or no.
Then I have SSIS package that creates new partitions in SSAS and drops non
existing partitions from SSAS based on records in that table.
After that my SSIS package process all partitions that have required
processing flag to 1 and then resets flag to 0.
My DW load SSIS package changes partition required processing flag to 1
for
partitions that requires to be reporcessed after re-load. Also special
routine creates/drops records from this table when required.Altough it
might
sound complicated, it is not really.
This is just an idea as nobody else replied to your original problem.


Regards,



"Ramunas Balukonis" <ramblk2 (AT) hotmail (DOT) com> wrote in message
news:1164706163.513596 (AT) loger (DOT) vpmarket.int...
Hi,

My nigthly job should process last partition. I use AMO object model
Server.Execute method. But how to known the last partition ID? Now I
use

AmoServer.Databases("db_id").Cubes("cube ID").MeasureGroups("Measure
Group
ID").Partitions(NumberOfPartitions - 1).ID

but this method returns not the last partition in my measure group, but
the
last created partition. I mean if I have partitions slst_2005, slst_2006
and
then created slst_2002, slst_2003, slst_2004, so this method will return
slts_2004. I would like to get the slst_2006 one. Of course, i can
programically do a loop through measure group partitions and take
partition
with max name. But I hope there are more elegant way. Any suggestions?
May
I
could make select from analysis services repository in some way??

Ramunas









Reply With Quote
  #5  
Old   
Ramunas Balukonis
 
Posts: n/a

Default Re: Get last partition name - 12-04-2006 , 04:03 AM



Hi, Yongli,
but actually how to retrieve the partition list sorted by part name? Simply
use "for each" loop with AMO? But I look for more elegant way .

Ramunas


"yongli" <yongli (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Ramunas,

It makes sense for the SSAS to return the partiton in the order of
creation.
There can be only one order to store the partitions, so the SSAS chooses
the
natural way to put the partititons into its collection in the order of
when
it was created. In order to get your last partition, you can retrieve the
whole partition list and sort them by the the descending order, then the
first in the list is your last partition.

"Ramunas Balukonis" wrote:

Hi, Vimas,
thanks, but it seems a bit comlicated. But I think SSAS stores metada in
some repository and I believe that I could select data directly.

Ramunas


"Vimas" <Vimas (AT) nospam (DOT) nospam> wrote in message
news:ei17w99EHHA.4108 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I had a similar problem, but I choose to resolve it different way.
I basically maintain a list of SSAS partitions in SQL Server table. I
also
have a flag on each partition if it has to be processed or no.
Then I have SSIS package that creates new partitions in SSAS and drops
non
existing partitions from SSAS based on records in that table.
After that my SSIS package process all partitions that have required
processing flag to 1 and then resets flag to 0.
My DW load SSIS package changes partition required processing flag to
1
for
partitions that requires to be reporcessed after re-load. Also special
routine creates/drops records from this table when required.Altough it
might
sound complicated, it is not really.
This is just an idea as nobody else replied to your original problem.


Regards,



"Ramunas Balukonis" <ramblk2 (AT) hotmail (DOT) com> wrote in message
news:1164706163.513596 (AT) loger (DOT) vpmarket.int...
Hi,

My nigthly job should process last partition. I use AMO object model
Server.Execute method. But how to known the last partition ID? Now
I
use

AmoServer.Databases("db_id").Cubes("cube ID").MeasureGroups("Measure
Group
ID").Partitions(NumberOfPartitions - 1).ID

but this method returns not the last partition in my measure group,
but
the
last created partition. I mean if I have partitions slst_2005,
slst_2006
and
then created slst_2002, slst_2003, slst_2004, so this method will
return
slts_2004. I would like to get the slst_2006 one. Of course, i can
programically do a loop through measure group partitions and take
partition
with max name. But I hope there are more elegant way. Any
suggestions?
May
I
could make select from analysis services repository in some way??

Ramunas











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.