kohana ORM factory does not show newly added column in database - kohana

I get this error,when i added a new column 'custom_url'.
I already had an instance of the ORM,when i fetch or try to save data for new column it gives me error saying that custom_url property does not exist.
Kohana_Exception [ 0 ]: The custom_url property does not exist in the Model_Event class

Are you using PDO driver? Because then you manually need to add all columns to the model's _table_columns.

Related

Azure Data Factory Copy XML Activity

I'm copying XML to a database using a "Copy Activity".
XML file has a nested structure so I have defined a "Collection reference" at "Cond_Tbl_Data_Record" level.
mapping
the following is written to db correctly.
`<Cond_Tbl_Data_Set>
<Cond_Tbl_Data_Record>
<Base_Per_Quantity>1</Base_Per_Quantity>
<Base_UOM_Code>GA</Base_UOM_Code>
<Condition_Table_ID>A02</Condition_Table_ID>
<Condition_Type>COCO</Condition_Type>
<Condition_Value>829</Condition_Value>
<Currency_Code>USC</Currency_Code>
<Extraction_Time>20230113 19:41:03</Extraction_Time>
<Key_Values>US/000001/001</Key_Values>
<Valid_From_Date>20230113</Valid_From_Date>
<Valid_To_Date>99991231</Valid_To_Date>
<Effective_Start_Time>13:22:42</Effective_Start_Time>
<Condition_Change_Value>300</Condition_Change_Value>
</Cond_Tbl_Data_Record>
<Cond_Tbl_Data_Record>
<Base_Per_Quantity>1</Base_Per_Quantity>
<Base_UOM_Code>GA</Base_UOM_Code>
<Condition_Table_ID>A04</Condition_Table_ID>
<Condition_Type>COCO</Condition_Type>
<Condition_Value>829</Condition_Value>
<Currency_Code>USC</Currency_Code>
<Extraction_Time>20230113 19:41:03</Extraction_Time>
<Key_Values>US/000001/002</Key_Values>
<Valid_From_Date>20230113</Valid_From_Date>
<Valid_To_Date>99991231</Valid_To_Date>
<Effective_Start_Time>13:22:42</Effective_Start_Time>
<Condition_Change_Value>300</Condition_Change_Value>
</Cond_Tbl_Data_Record>
</Cond_Tbl_Data_Set>`
but the following is not written to db at all.
`<Cond_Tbl_Data_Set>
<Cond_Tbl_Data_Record>
<Base_Per_Quantity>1</Base_Per_Quantity>
<Base_UOM_Code>GA</Base_UOM_Code>
<Condition_Table_ID>A02</Condition_Table_ID>
<Condition_Type>COCO</Condition_Type>
<Condition_Value>829</Condition_Value>
<Currency_Code>USC</Currency_Code>
<Extraction_Time>20230113 19:41:03</Extraction_Time>
<Key_Values>US/000001/001</Key_Values>
<Valid_From_Date>20230113</Valid_From_Date>
<Valid_To_Date>99991231</Valid_To_Date>
<Effective_Start_Time>13:22:42</Effective_Start_Time>
<Condition_Change_Value>300</Condition_Change_Value>
</Cond_Tbl_Data_Record>
</Cond_Tbl_Data_Set>`
I tried to reimport schema but still did not work
As per information you are providing when your file has single object in array Its not getting copied.
The cause of issue is when you have single object in array it will take it as object not as array.
To resolve the issue, you have to first clear the mapping and then again import the mapping. So, it will take that as another object not an array as shown in below image:
My sample input:
Output:

Add new attribute to existing document

How do I add an attribute to all documents in collection using mongoengine?
I've tried several ways:
for d in MyDocuments.objects:
d.attr = 'test'
d.save()
This doesn't give any errors but it doesn't add new attribute to document.
I've also tried
MyDocuments.objects.all().update(set__attr='test')
This gives InvalidQueryError: Cannot resolve field "attr"
The same error happens when I try
for d in MyDocuments.objects:
d.update(set__attr='test')
Specifically I'm trying to add _cls attribute because I enabled inheritance and I already have some objects in database that don't have that attribute.
Finally this worked for me:
MyDocuments._get_collection().update_many({}, {'$set': {'_cls': 'MyDocuments.TTR'}})

Specify columns in empty IQueryable in WCF Data Service?

I have a DataService with the following queryable:
public IQueryable<MyData> MyDataList => myDataList.AsQueryable();
I connect to this data service in Excel 2016. Everything works, but when the list is empty I get the following error message.
The query did not run or the Data Model could not be accessed.
Here's the error message we got:
An Evaluate statement cannot return a table without columns
It seems the client (Excel) needs an object to successfully determine the columns. Why? Is it possible to tell the client about the columns without the need for an object?
Can't you check the resulted query first to see if it contains anything and return the actual data or a default one?
var defaultList = new List<MyData>();
public IQueryable<MyData> MyDataList = (myDataList.Any())?myDataList.AsQueryable():defaultList.AsQueryable();

Rename Object not supported in Azure SQL Data Warehouse?

[Posting question from customer on an internal thread]
I tried to run the following commands in SQL DW:
RENAME OBJECT dbo.test TO test2
RENAME OBJECT test TO test2
Both failed with the following error:
No item by the name of '[DemoDB].[dbo].[test]' could be found in the current database 'DemoDB', given that #itemtype was input as '(null)'.
Is this a defect or is there a workaround that I can use?
RENAME is now supported. In order to use rename object you must prefix the table you want to change with the schema name like this:
RENAME OBJECT x.T_New TO T;
Notice that there is no schema qualification on the target. This is because the renamed object must continue to reside inside the same schema. To transfer a table from one schema to another you need to use the following command:
ALTER SCHEMA dbo TRANSFER OBJECT::x.T_NEW;
RENAME is now supported. In order to use rename object you must prefix the table you want to change with the schema name like this:
RENAME OBJECT x.T_New TO T;
Notice that there is no schema qualification on the target. This is because the renamed object must continue to reside inside the same schema. To transfer a table from one schema to another you need to use the following command:
ALTER SCHEMA dbo TRANSFER OBJECT::x.T_NEW;
In case someone else is looking at the time. It posible now in Azure Synapse Analytics, formely Azure SQL Datawarehouse; you can go with:
ALTER DATABASE AdventureWorks2012
MODIFY NAME = Northwind;

Unable to update the EntitySet (no insert function)

I have this tables in my data base:
Videos(IDVideo, Name...)
Episodes(IDEpisode, Name...)
Versions(IDVersion, Name, ....)
VideosVersions(IDVideo, IDEpisode, IDVersion)
A version can be for a video or for the episode and the relation in both cases is N:N, a video can have many versions and a version can be asigned to many videos or episodes.
In my edmx model has the four tables.
When I try to assign a new version to a video for example I use this code:
VideosVersions myVideoVersion = new VideosVersions();
myVideoVersion.IDVideo = paramVideo.IDVideo;
myVideoVersion.IDVersion = paramVersion.IDVersion;
myContext.VideosVersions.Add(myVideosVersions);
myContext.SaveChanges();
But I get the following exception:
Unable to update the EntitySet 'VideosVersions' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.
Why?
Thanks.
EDIT: in my entity in the edmx model the three properites has a key, so if I am not wrong, this means that the PK of the entity is the combination of the three fields, is correct?
The mapper probably couldn't figure out which columns should be the primary key of VideosVersions. This means it doesn't know how to insert new records and only provides the query method. Make sure you have the primary key properly defined on the table, then update the mapping.

Resources