Use flask_migrate to manage an old database - alembic

I now have an old database and a lot of data cannot be deleted. Now I want to use flask_migrate to migrate the database. What should I do to use it without changing the original database structure?

Related

How to synchronize to match data from the mysql database with the internal sqflite database?

I'm new to flutter.
I want to sync local sqflite database from external mysql database. What is the best way
If I were you, I would create a function in Firebase Functions to send data from each table. And I would try to make the fields in both tables with the same names as much as possible as a way to facilitate maintenance

Maintaining a development database with exactly the same schema

I'm trying to run a different database for development as my initial product release is coming so I'd like to know how to maintain two different databases. I'm using postgresql as my DBMS
I want development database and production database to have exactly the same schema. Is there a way to do this automatically? If I have to to manually, what would be the best way to update schema?
thank you
I want development database and production database to have exactly the same schema.
Then just create 2 databases with the same schema(s).
Or you can read more about template databases - https://www.postgresql.org/docs/11/manage-ag-templatedbs.html.
The idea is that when you create new database, it's actually copied from template1, thereof you can edit template1, and every new database will have schemas/tables that you need.

sync normalize tables vs json table in postgresql, so i can use graphql and sql, future neo4j

I have not found real sync from postgreSql to new graph database like neo4j, so I've decide to use same postgresql to sync one normalise tables with json table on the same postgresql with a differenta name for a database. So i have the best of two worlds, sql and nosql database.
When i see sql is more fast than graphql i can choose, and in the future, when i moved the nosql tables to a real graph database like neo4j and i ll be able to sync, i dont need to change the app that can use both database synced
Someone did already this? or it's a dumm idea? Or someone already use automatic libraries to sync from postgresql to neo4j ? and the another sens too ? or must I write sync scripts from scratch if i want to sync two databases?

libpq code to create, list and delete databases (C++/VC++, PostgreSQL)

I am new to the PostgreSQL database. What my visual c++ application needs to do is to create multiple tables and add/retrieve data from them.
Each session of my application should create a new and distinct database. I can use the current date and time for a unique database name.
There should also be an option to delete all the databases.
I have worked out how to connect to a database, create tables, and add data to tables. I am not sure how to make a new database for each run or how to retrieve number and name of databases if user want to clear all databases.
Please help.
See the libpq examples in the documentation. The example program shows you how to list databases, and in general how to execute commands against the database. The example code there is trivial to adapt to creating and dropping databases.
Creating a database is a simple CREATE DATABASE SQL statement, same as any other libpq operation. You must connect to a temporary database (usually template1) to issue the CREATE DATABASE, then disconnect and make a new connection to the database you just created.
Rather than creating new databases, consider creating new schema instead. Much less hassle, since all you need to do is change the search_path or prefix your table references, you don't have to disconnect and reconnect to change schemas. See the documentation on schemas.
I question the wisdom of your design, though. It is rarely a good idea for applications to be creating and dropping databases (or tables, except temporary tables) as a normal part of their operation. Maybe if you elaborated on why you want to do this, we can come up with solutions that may be easier and/or perform better than your current approach.

Restoring default records to a Core Data database

I have an iPhone app that has a sqlLite Core Data model that is pre-loaded with default data. I want to enable the user to restore this default data if they have modified or deleted records from the model, while retaining any new records added to the model by the user.
The sqlLite database is copied to the users documents directory on first run, so the untouched original database is available in the app package. What is the easiest way to copy records between the two databases? I assume that it involves setting up an additional persistentStoreCoordinator, or adding the original dB to the coordinator as an additional persistentStore, but the docs are skimpy on how to do this.
Thanks,
Jk
If you do not want to delete the destination store and just overwrite it then the workflow is:
Stand up a second Core Data stack with the source persistent store.
Fetch each entity from the source.
Look for the object in the destination.
If it exists, update it.
If it doesn't, create it.
Save the destination store.
Depending on how much data you have, this can be a very expensive operation.