Update core data database based on criteria using NSBatchUpdate function - swift

I couldn't find anywhere for the answer. I have a database implemented with simple core data and an entity filled with data. Every time I open the app, I need to go through all database and one column contains a date. If the date is already passed (compared to today) I need to add one year to it.
After googling I found that NSBatchUpdate could help here. But how to go through all records in the database and update date value based on criteria?
Thanks in advance for support.

Related

SAP incremental data load in Azure Data Factory

I'm trying to implement an Extractor pipeline in ADF, with several Copy Data activities (SAP ERP Table sources). To save some processing time, I'd like to have some deltas (incremental load). What's the best way to implement this?
What I'm trying at the moment is just to use the "RFC table options" in each Copy Data activity. However, this seems to be quite limited (only very simple queries allowed). Also, each SAP ERP table requires a different query. I found 3 different situations, regarding table field formats:
Timestamp in miliseconds (e.g. COVP);
Timestamp in YYYYMMDDHHMMSS (e.g. FAGLFLEXA);
Last change date and last change time, in separated fields (e.g. CATSDB)
Has anyone ever tried this? What would you advise?
Thanks!

Postgres Insert Timestamp Loses Time Portion

I have done the research and haven't found any solution to the following issue.
I wrote a small utility to move data from SQLServer to Postgres using .NET Core and EF Core. Everything works fine except after data transfer Postgres timestamp loses time portion. Source class field as well as destination defined as DateTime. Context dataset before update indicates date correctly - that is including time like so: '{8/8/2018 6:04:15 AM}'. But when I call SaveChanges() and review data in target Postgres DB - date shows up without time portion: "2018-08-08 00:00:00".
This happens with TZ or without. Inserting the data using query, results in correct timestamp. So, it looks like the problem with Npgsql.EntityCore.PostgreSQL adapter to me...
So, has anyone encountered any similar issue? Any ideas, tips are greatly appreciated!

SQL Update script in Qlik Sense

I am using Qlik Senes 2.2. The date source from a DB server. I have a table with 6 columns and 2 of them have "null" values (one of the field is a bool type and the other one is text). What I want ,after making selections, to update this two fields in the Data Warehouse from a Qlik Sense app. Is there a possibility to run back the SQL update script from the Qlik Sense.
I hope there is a way that help me out.
Thanks a lot in advance.
Ziad.
The short answer is "No".
One way to make it work is to develop an extension that posts data (when needed) to web service which then update the database

Best strategy for db update when updating application

I have function that initialize my database create tables etc.
Now I prepare version two of the application and in this function at the end I added check for column existence and if not exist I alter table.
My question is:
To avoid checking this all the time is it good to put in UserDefaults some flag that indicate that current app is version two and if it is to avoid this code?
This seams logical to me but other opinion is always welcome ;)
You could have a version number table/column in your database which stores the schema version number. Every time you change the schema, increment the number in your application file and then run the relevant migration code to get from one schema version to another whilst updating the schema version in the database.
This answer has a handy way of tracking db schema version numbers without creating a separate table in SQLite
Yes, you can user NSUSER Default to check this. I don't think anything wrong with this.

Syncing Core Data Databases in iOS applications

I have a doubt about Core Data migration.
Say I have an application which has some predefined values in a table A. I want to sync it with another database, with a table B in such a way that when new records are added totable B, that record should get added to my table A.
I know using Core Data migration, when I add columns to a table, I will be able to access the values previously stored in the older table before the addition of the column.
I would like to know how my table can be updated with the added records on another table.
Update:
From comment below:
The question I had in mind is this...
I want to release an update for my
app. I'm stuck on how to update the
existing Core Data database which also
stores data entered by the user. All I
need to do is update a couple of
records and preserve current user
data. How do I do this?
Core Data is not SQL. Entities are not tables. Objects are not rows. Columns are not attributes. Core Data is an object graph management system that may or may not persist the object graph and may or may not use SQL far behind the scenes to do so. Trying to think of Core Data in SQL terms will cause you to completely misunderstand Core Data and result in much grief and wasted time.
That way lies madness.
It sounds like you don't actually want to migrate as the term is used in Core Data. Migration in Core Data means moving from an earlier version of a data graph's persistent store to a newer version of the same.
E.g. In the 1.0 version you have an entity Person with the attributes firstNameand lastName. After the app has been release you wish to update to the 2.0 version and add a phoneNumber attribute to the Person entity. You would use migration to update the user's existing object graphs and persistent stores to the new object graph.
If by "table" you actually mean entities, then you can link entities together in a relationship so that they can watch each other. If by "table" you mean a data model or persistent store, then the answer is more complex. It can be done using configurations, fetched attributes, UUIDs etc but you must understand what you really need to do before you jump through all those hoops.