"Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'bi_assets_dim_site', Column: 'postcode', Value: 'LE3 9LD'.
I get this duplicate key error on the processing of my SSAS cube. The column itself is not a key. There can be multiple postcodes assigned to a site.
When I process the cube, dimensions first and then then measures (the cube itself). It processes successfully.
However, once it runs via the SQL job activity monitor/scheduler. It fails on this error again.
the command called
<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200">
<Object>
<DatabaseID>Site Cube</DatabaseID>
</Object>
<Type>ProcessFull</Type>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>
The error message sounds as if you have an attribute relationship defined from some attribute to the postcode attribute in your site dimension. Defining an attribute relationship tells Analysis Services that there is a many-to-one relationship from one attribute to the other. If - as you write, there can be more than one postcode per site, then you cannot have an attribute relationship from site to postcode. Removing this from the dimension should get rid of the processing error.
Related
I am new to SSAS and am setting up a proof of concept. I love the idea of Role-Playing dimensions, but i'm having trouble getting one setup that is NOT based on dates. Here is the use-case:
In our ERP system, we have a fact table we'll call "Time Entries" that has:
User_ID
Biller_ID
Approver_ID
Hours Worked
ETC
I also have a "Resource" table that i'm relating these to as foreign keys:
Resource_ID
Department_Name
ETC
When I create my Data Source View, I create a relationship between:
User_ID -> Resource_ID
Biller_ID -> Resource_ID
Approver_ID -> Resource_ID
My "Resource" Dimension can be successfully deployed and processed, and has the following Attributes:
Resource_ID
Department Name
My "Work Entries" cube has one measure, "Hours Worked". When I add in my "Resources" dimension, it creates three roleplaying dimensions:
User
Approver Resource
Biller Resource
When I go to process, i'm receiving the following error:
Errors in the OLAP Storage Engine: The attribute key cannot be found when processing: Table: 'Time Entries', Column: 'user_id', Value: 'some number', The Attribute is 'Resource ID'.
So far, the only post I've followed that allowed me to successfully troubleshoot is this one:
https://www.sqlservercentral.com/Forums/1219713/Errors-in-the-OLAP-storage-engine-The-attribute-key-cannot-be-found-when-processing-Even-though-key-Exist-in-Dim-Table
TL;DR -
I've delete the relations between the factable and dim tables in the database.
I refresh the dataSourceViews and thera are no relations between tables
I remove the dimentions in the cube design
I recreate the dimentions in the cube design
I build then relations in the dataSourceViews between the foreign key in the factable and the primary keys in dim tables
i reprocesed the cube
The problem with this is that because we've added the dimension back BEFORE creating the relationships, we don't have our roleplaying dimensions.
I feel like i'm missing something simple here, but I can't quite figure it out. Can anyone tell me why my roleplaying dimensions aren't working?
Roleplaying function of a dimension does not depend on its type. Your dimensions can be used in role-playing scenario like Date dimension.
On your problem - SSAS engine might build sometimes strange queries extracting dimension data, especially when your dimension is based on data from several tables. To check and investigate it:
Fix user_id value from your error message
Do process update or process full on corresponding dimension, and get SQL query used for processing user_id attribute from processing window form. It is under processing user_id attribute log entry.
Copy SQL query and run it. Check whether it returns id from the error message above.
If the value is missing - investigate the query
In my experience - such things occurred when an erroneous dimension was built on two tables with some relation. SSAS engine have built query with strict inner join, and it has to be less restrictive left outer join.
You can fix it with SSDT playing with DSV attribute being non-empty, but I found more simple to write a SQL query with proper joins in DSV directly.
Suppose that you have a database table with only one column of type xml to hold various key/value pairs of user defined datatypes, like this, for example:
Row 1:
<column>
<name>id</name>
<value>1</value>
</column>
<column>
<name>e-mail</name>
<value>abc1#abc.com</value>
</column>
Row 2:
<column>
<name>id</name>
<value>2</value>
</column>
<column>
<name>e-mail</name>
<value>abc2#abc.com</value>
</column>
Now suppose that you want to enforce, in your application code, the integrity constraint that the 'e-mail' column be unique across all the rows, like a database UNIQUE constraint. If I was using a regular database column to hold this, the database itself would take care of this for me, but as I'm using this design now I have to do this by myself.
So, I'm just here asking what would be the right approach to accomplish this in code. In my point of view the only way is to block the entire table everytime a user needs to add another row of update the name 'column' of an existing row.
Any other alternatives?
With a RDBMS (relational) database system it doesn't really make sense to does it? Your value is the xml document itself and if you cared about the email as a value it would have its own column. The fact that it doesn't means you don't care about it being unique - that's the whole point of the relational model.
With postgres you could create a functional index but I'm not sure it's worth the trouble unless this is only a corner of your database and the rest is relational.
There are dozens of document-based database systems that might be suitable for your needs if this is really what you want to do though. It's difficult to say more because they all have different aims and behaviours and track records.
I have a fact table that has a RESOURCE_ID that links to the resource table. A resource has a role, that it self is a resource.
.--FACTTABLE--.
| IDENTIFIER | .--RESOURCE---.
| RESOURCE_ID |----| RESOURCE_ID | .--RESOURCE---.
| ROLE_ID |----| RESOURCE_ID |
| TITLE |
Now i want to create a dimension ROLE that contains the attribute TITLE.
How to do this? Example with Mondrian 4 Schema would be appreciated.
I know there is a <Link> for the <PhysicalSchema> and the <ForeignKeyLink> for the <DimensionLinks> but i don't know how to use them properly.
Okay i found out how to do this.
Solve cycles
Since role and resource are both from the table RESOURCE, Mondrian couldn't handle that and came into a cycle.
I solved this with an alias for the RESOURCE table:
<Table name="resource" schema="public" keyColumn="id" alias="role"/>
Link tables
To let Mondrian know which resource belongs to which role, you need to link both tables.
Therefor it's important that the resource table has a key:
<Table name="resource" schema="public" keyColumn="id"/>
Now you can link the resource to it's role:
<Link target='resource' source='role' foreignKeyColumn='role_id'/>
Define the dimension
The confusing thing at first, is that the role dimension needs the table resource. That's because the fact table only knows the RESOURCE_ID and not the ROLE_ID. But since every resource is linked to it's role, you can use the Attributes to define the role specific fields.
<Dimension name="Role" table="resource" key="ID">
<Attributes>
<Attribute name="ID" keyColumn="id" hasHierarchy="false"/>
<Attribute name="Title" table="role" keyColumn="title"/>
</Attributes>
</Dimension>
Use the dimension
To use the dimension we have to use the dimension in the cubes dimensions and link the RESOURCE_ID of the fact table to the role dimension.
Useage:
<Dimension source="Role"/>
DimensionLinks:
<ForeignKeyLink dimension="Role" foreignKeyColumn="resource_id"/>
One of our production cube failed with the following error message:
Source: Analysis Services Execute DDL Task Analysis Services Execute
DDL Task Description: Errors in the OLAP storage engine: The
attribute key cannot be found when processing: Table:
'dbo_vw_FACT_OperationalTimeSheetData', Column: 'CurrentHomeLaborOrg',
Value: '117-MARKETPLACE-38'. The attribute is 'KeyOrganisation'. End
Warning Warning: 2013-07-22 06:26:07.51 Code: 0x811F0002
Source: Analysis Services Execute DDL Task Analysis Services Execute
DDL Task Description: Errors in the OLAP storage engine: The
attribute key was converted to an unknown member because the attribute
key was not found. Attribute KeyOrganisation of Dimension: Current
Home Organisation from Database: LadbrokesReporting2005, Cube: MIS
Clone, Measure Group: Kronos Time Sheet, Partition: 201307, Record:
179774. End Warning
On extensive google searches for the above error message I learnt this is due to referential integrity i.e some rows in the fact table could not be linked to the dimension table. In my previous analysis I figured that the for some of the values like the one given above in the error message '117-MARKETPLACE-38' in the fact table , the format in the dimension table was '117_Marketplace_38'. However, I have unearthed some striking facts :-
The query for the view which populates the fact converts data inthe the format '117-MARKETPLACE-38'. The format of the data in the source tables is '117_Marketplace_38'.
There are many other entries of the format '117-Marketplace-38'. However, the error seems to be present only for that entry. So how come others are getting accepted but this isnt?
I've run out of ideas. Hence, it would be great if someone could help me out on this.
Are you sure that the dimension is processed? Remember that as it links the facts to the dimensions, it does so on the SSAS dimension, not the underlying SQL table. Try running a process(Update) on the dimension first?
In your original post you're mixing upper and lower case, MARKETPLACE and Marketplace. Is this how it is in the source? It could be that it isn't treating them as the same. I've seen SSAS have issues with "Id" versus "ID"
Possible relative of ssas attribute key cannot be found even though it exists and is not due to duplicates
Edited comments into answer after acceptance.
I got this same error message, but had to handle it differently in my case: details below for others who run into the same issue.
In my scenario, I was connecting my fact table to another fact table via a bridge table. This bridge table was formed via an INNER JOIN, so it only had records that matched in both; legitimately, then certain rows in FactTableA were not in the BrgTable joining to FactTableB.
To allow FactTableA to process even when there were no valid links to BrgTable, I followed these instructions from TechNet:
Referential Integrity Issues in Fact Table
The sales fact table has records with product_id that does not exist
in the product dimension table. The server will produce a KeyNotFound
error during partition processing. By default, KeyNotFound errors are
logged and counted towards the key error limit, which is zero by
default. Hence the processing will fail upon the first error.
The solution is to modify the ErrorConfiguration on the measure group
or partition. Following are two alternatives:
Set KeyNotFound=IgnoreError.
Set KeyErrorLimit to a sufficiently large number.
The default handling of KeyNotFound errors is to allocate the fact
record to the unknown member. Another alternative is to set
KeyErrorAction=DiscardRecord, to discard the fact table record
altogether.
For me, I had to go to the partition associated with the failing measure group, open up the Properties pane, set ErrorConfiguration to Custom, and then expand Custom and set KeyNotFound to IgnoreError.
I have an issue on my hands that I've spent several days searching for an answer to no avail...
We're using HiLo Id generation, and everything seems to be working fine, as long as the entity table is in the same schema as the hibernate_unique_key table.
The table structure is pretty simple. I have my hi value table in the db as dbo.hibernate_unique_key. Several entity table are also in the dbo schema, and they work without issue. Then we have tables under the "Contact" schema (such as Contact.Person and Contact.Address).
In the Person Mapping file:
<class name="Person" table="Person" schema="Contact">
<id name="Id" unsaved-value="0">
<generator class="hilo">
<param name="max_lo">100</param>
</generator>
</id>
...
When I try to insert a Person entity, I get an error of "Invalid object name 'Contact.hibernate_unique_key'. That error is certainly clear enough. So I add:
<param name="schema">dbo</param>
to my mapping file/generator element. Now, when the SessionFactory is built, I get a "An item with the same key has already been added." error. So now I'm a bit stuck. I can't leave the HiLo generator without a schema, because it picks up the schema from the Class, and I can't specify the schema because it's already been added (presumably because it's my "default_schema" as identified in my XML cfg file).
Am I completely hosed here? Must I either
A) Keep all my tables in the dbo schema or
B) Create a separate HiLo Key table for each unique schema in the DB?
Neither of those scenarios is particularly palatable for my application, so I'm hoping that I can "fix" my mapping files to address this issue.
Only one such table per database should exist. Such data table should imply the following columns (let's call this table Parameters):
HiLoId
TableName
ParamName
HiLoAssigned
In addition to be used as a HiLo assignment data table, this could be used as a parameter table. As such, the ParamName field is required. This could contain data such as:
HiLoId | TableName | ParamName | HiLoAssigned
---------------------------------------------
1 | Parameters| HiLoId | 3
2 | Customers | CustomerId| 9425
3 | Invoices | InvoiceId | 134978
And when you need some other parameters, such as a parameter for a job that would prune your tables for history, then an age parameter for record could be inserted into it.
Well, I'm a little further in the subject than what you actually asked. Just sharing some additional thoughts in database design/architecture.
Take an eye out this question, and see my answer there. This might answer your question as well, and bring further information to this answer.
Have you tried specifying the schema with the table name on all generators (including the ones already in the dbo schema? I.e.
<param name="table">dbo.hibernate_unique_key</param>
The hilo generator looks for a '.' in the table name, and qualifies it (with schema) only if one isn't there.
I don't think there's anything wrong with solution B. Behavior will be pretty much the same.