Databasechangelog file already exists error in postgres - liquibase

I tried to setup default schema, it didn't work. I am using postgres db and trying to test it on my local system.
I am not using any application. I am just trying to update db directly using changelog

Related

PostgreSQL error : the "PostAudienceEnum" type already exists

I generated a migrate.sql file from the prisma ORM which I then imported into my PostgreSQL database from Query Tool. However when I run this file I get the error: the "PostAudienceEnum" type already exists . I don't know why yet I did declare PostAudienceEnum as an enum . Here are the lines where we find the enumeration PostAudienceEnum:
-- CreateEnum
CREATE TYPE "PostAudienceEnum" AS ENUM ('PUBLIC', 'FRIENDS', 'ONLY_ME', 'SPECIFIC');
CREATE TABLE "Post" (
...
"audience" "PostAudienceEnum" NOT NULL DEFAULT E'PUBLIC',
...
CONSTRAINT "Post_pkey" PRIMARY KEY ("id")
);
This file was designed from my prisma schematic. I don't know how to modify it without messing up my database and why PostgreSQL throws this error.
You might be getting this error if the database already has data, and you're attempting to manually execute the SQL file against the database. You should only use prisma migrate to manage changes in your schema against your database. Prisma internally records what migrations have and have not been executed against the database, and attempting to run an SQL file manually outside of prisma migrate defeats the purpose of using it in the first place.
Migrate docs: https://www.prisma.io/docs/concepts/components/prisma-migrate
You should ONLY use Prisma Migrate to make changes to your database tables/columns/relationships, and not an external tool. However, if you are developing your database FIRST and then looking to keep your Prisma schema up to date with your database (and not the other way around), you will want to introspect your database. Same deal applies: Prisma knows what parts of your database are reflected in your Prisma schema and what's not.
Introspection docs: https://www.prisma.io/docs/concepts/components/introspection

Committing hudi files manually

I am using spark 3.x with apache-hudi 0.8.0 version.
While I am trying to create presto table by using hudi-hive-sync tool I am getting below error.
Got runtime exception when hive syncing
java.lang.IllegalArgumentException: Could not find any data file written for commit [20220116033425__commit__COMPLETED], could not get schema for table
But I checked all data for partitiionKeys using zepplin notebook , I see all data present.
Its understood that I need to do manually commit the file. How to do it ?

How to load chinook database in SQLite

I want to load chinook database in SQLite but I have no idea how can I do that.
First, I used this command but it just made a file without anything in it:
sqlite3 chinook.db
I also downloaded this archive that contains chinook database but I couldn't find chinook.db file to open it with this command:
.open chinook.db
If you have a copy of the chinook database then just use the restore database feature.
cd /home/sqlite
mv sample.db sample.db.old
sqlite3 sample.db < sample.bak
For more information go to http://www.ibiblio.org/elemental/howto/sqlite-backup.html
We should script the database before using it. Here is the link that discussed the whole procedure.

Run a initial Liquibase script

This is my 2nd day using Liquibase.
I have a 'backup' or 'Repositry' with the database that I need to create locally on my PC.
I have looked at the documentation, but Im realy not 100% clear on how to run it.
Ive updated the Liquibase.properties file to reflect the correct paths and username and passwords.
How do you run the update command to generate the tables and test data.
Windows 7
The Liquibase documentation on 'Adding Liquibase to an existing project' is probably the best place to start. Basically, you want to set the properties file so that it refers to the existing 'backup' database, and then run liquibase generateChangeLog
This will connect to the existing database and generate a file that contains the structure of the existing database expressed (typically) in an XML file called a changelog. You then create a new properies file that will connect to your local database and use liquibase update to apply the changelog to the local database and populate the structure. Note that this does not typically transfer the data from the existing database to the new database, just the structure - the tables, keys, indexes, etc. If you want to have test data as well, you can either export that data from the existing database, or you might look into crafting the changesets manually. To export the data, a command like this would be used:
java -jar liquibase.jar --changeLogFile="./data/<insert file name> " --diffTypes="data" generateChangeLog

Create/Update Postgresql table via Microsoft SSIS package

I want to do the following two things:
Create a table "Lite AC" with two columns (id, lite_ac) in a Postgresql database via Microsoft SSIS package
Update that newly created table via another SSIS package
I want to use that table in order to integrate it into a WHERE SUBSTRING IN (Lite AC) statement.
I am using pgAdmin to connect with that Postgresql database. I know how I can export data from Postgreql via an SSIS package so all the drivers should be installed, but no idea how to do that the other way round.
Is that possible?
I do not have Postgres installed.
You need two connection managers. One for source and the other for destination.
In your case destination is Postgres DB. In order to test out, you may use a Flat File Connection to insert set of sample data from a .txt file. Following tutorial emphasizes on Login credentials to Postgres DB.
Install the relevant drivers (32bit and 62bit accordingly)
Follow this tutorial
Once you are able to connect to Postgres DB via SSIS and rows are inserted into the DB using .txt file - try to add a SQL Scripting Task to be executed after Data Flow Task, so to update the records in the new table.