Database Administrators
Q&A for database professionals who wish to improve their database skills
Latest Questions
0
votes
1
answers
222
views
Reading from .sql file located in Visual Studio repository
A user.sql file which contains USE [database] GO -- Legacy users cleanup DROP USER IF EXISTS [dw]; etc... is located at the repository: https://company.visualstudio.com/Database/_git/Azure?path=etc... I have a powershell script running on a VM that restores the database and I need it to remove users...
A user.sql file which contains
USE [database]
GO
-- Legacy users cleanup
DROP USER IF EXISTS [dw];
etc...
is located at the repository: https://company.visualstudio.com/Database/_git/Azure?path=etc ...
I have a powershell script running on a VM that restores the database and I need it to remove users from the newly restored db using the above user.sql file.
Is there a way to access the file directly from the .ps1 script, read the code from it and execute it?
If not, what would be the steps to make it work?
Thanks and regards.
TheNixon
(371 rep)
Dec 9, 2022, 05:05 PM
• Last activity: Jun 11, 2025, 11:05 PM
2
votes
2
answers
1769
views
push using git integration in DBeaver
I am using the git plugin for DBeaver. While I can commit, I am not seeing an option to push the commit over to master. Am I missing something?
I am using the git plugin for DBeaver. While I can commit, I am not seeing an option to push the commit over to master. Am I missing something?
Saqib Ali
(121 rep)
Feb 5, 2020, 02:15 AM
• Last activity: May 8, 2025, 11:00 AM
1
votes
2
answers
143
views
Attempt to build Cassandra Lucene index failed, cannot checkout version 4.0.7
Lucene Index is managed by Instaclustr (https://github.com/instaclustr/cassandra-lucene-index) in Cassandra 4.x instead of Stratio who supported till V3.x. I have tried to test the Index creation but failed with below issues. Anyone please help. I have raised this in git but somehow missed by team....
Lucene Index is managed by Instaclustr (https://github.com/instaclustr/cassandra-lucene-index) in Cassandra 4.x instead of Stratio who supported till V3.x.
I have tried to test the Index creation but failed with below issues.
Anyone please help. I have raised this in git but somehow missed by team.
It would be of great help if anyone who successfully implemented this can share steps.
~/cassandra-lucene-index$ git checkout 4.0.7
error: pathspec '4.0.7' did not match any file(s) known to git
Subsequently below step failed also
mvn clean package


Cassandra Thrift
(307 rep)
Mar 31, 2023, 12:40 PM
• Last activity: Mar 31, 2023, 03:59 PM
0
votes
1
answers
122
views
Gitlab's praefect enormous wal generation on postgresql
We have praefect's database about 500 Mb in size, but wal generation per week is relly huge - about 1Tb. Most frequent query is being executed ~8 times/minute: ``` WITH lock AS ( SELECT id FROM replication_queue_lock WHERE id LIKE $1 || $4 || $2 || $5 AND NOT acquired FOR UPDATE SKIP LOCKED ) , cand...
We have praefect's database about 500 Mb in size, but wal generation per week is relly huge - about 1Tb.
Most frequent query is being executed ~8 times/minute:
WITH lock AS (
SELECT
id
FROM
replication_queue_lock
WHERE
id LIKE $1 || $4 || $2 || $5 AND
NOT acquired
FOR UPDATE SKIP LOCKED
)
, candidate AS (
SELECT
id
FROM
replication_queue
WHERE
id IN (
SELECT DISTINCT
first_value(queue.id) OVER(PARTITION BY lock_id, job ->> $6 ORDER BY queue.created_at)
FROM
replication_queue queue
JOIN
lock
ON queue.lock_id = lock.id
WHERE
queue.state IN (
$7
, $8
) AND
NOT EXISTS(
SELECT
$9
FROM
replication_queue_job_lock
WHERE
lock_id = queue.lock_id
)
)
ORDER BY
created_at
LIMIT $3
FOR UPDATE
)
, job AS (
UPDATE
replication_queue queue
SET
attempt = CASE
WHEN job ->> $10 = $11 THEN
queue.attempt
ELSE
queue.attempt - $12
END
, state = $13
, updated_at = timezone(
$14
, now()
)
FROM
candidate
WHERE
queue.id = candidate.id
RETURNING
queue.id
, queue.state
, queue.created_at
, queue.updated_at
, queue.lock_id
, queue.attempt
, queue.job
, queue.meta
)
, track_job_lock AS (
INSERT INTO replication_queue_job_lock(
job_id
, lock_id
, triggered_at
)
SELECT
job.id
, job.lock_id
, timezone(
$15
, now()
)
FROM
job
RETURNING
lock_id
)
, acquire_lock AS (
UPDATE
replication_queue_lock lock
SET
acquired = $16
FROM
track_job_lock tracked
WHERE
lock.id = tracked.lock_id
)
SELECT
id
, state
, created_at
, updated_at
, lock_id
, attempt
, job
, meta
FROM
job
ORDER BY
id;
Is there any way to tune application to slow this thing down?
Daniil Aksenov
(1 rep)
Jan 30, 2023, 11:17 AM
• Last activity: Jan 30, 2023, 06:22 PM
1
votes
1
answers
1071
views
Git corrupts SQLite database
I use SQLite for websites I create and manage for my clients (I am a web developer). They are very small and straightforward databases. This is now happened twice, so it is pretty clear that it wasn't a fluke. This last one was a clear set of steps that then corrupted the database: 1. Open the datab...
I use SQLite for websites I create and manage for my clients (I am a web developer). They are very small and straightforward databases.
This is now happened twice, so it is pretty clear that it wasn't a fluke. This last one was a clear set of steps that then corrupted the database:
1. Open the database in SQLite3 by linux command line
2. Make a mistake in the data
3. Ask Git to restore the released version of the file (this is reaching out to GitHub for the copy)
4. Open the restored version, and file is corrupt
I then struggle to get it back in order, nothing I do in git fixes it. I can luckily grab it from the live website (no updates there) and all is well.
My two questions:
1. Is there something I can do differently while getting the file from the git repository to revert, it is not clear to me why git would corrupt the file
2. Is there something I can do that is easier to restore the file other than get the copy from the live website
Katie
(121 rep)
Apr 8, 2020, 03:20 PM
• Last activity: Sep 30, 2022, 04:05 AM
2
votes
2
answers
2091
views
pg_dump hangs in Git Bash but works in Windows command line
I tried to make a backup of a database from Git Bash environment, but the executable does not output anything. If I specify the filename using the `-f` flag, a blank file gets created, so the executable obviously runs, but it does not do anything - there is no output or activity. Using the `-v` flag...
I tried to make a backup of a database from Git Bash environment, but the executable does not output anything.
If I specify the filename using the
-f
flag, a blank file gets created, so the executable obviously runs, but it does not do anything - there is no output or activity. Using the -v
flag also does not make it produce any output.
If I run pg_dump --help
, I do get output though.
When I do the same from a Windows command line, I am asked for a password and the dump proceeds fine.
What is different about the Git Bash environment that pg_dump
does not work there? Is there any workaround? I prefer to stay out of the Windows command line if at all possible.
JohnEye
(193 rep)
Nov 3, 2021, 08:40 PM
• Last activity: Nov 4, 2021, 10:57 AM
1
votes
0
answers
197
views
Integrating Flyway and Github
I was wondering if any of you can share some experience regarding integrating Flyway and Git. We're currently developing a project, each sprint we need to make database changes for new features of course. Once every two weeks we merge changes made in dev DB to prod DB (the code reside on different b...
I was wondering if any of you can share some experience regarding integrating Flyway and Git. We're currently developing a project, each sprint we need to make database changes for new features of course. Once every two weeks we merge changes made in dev DB to prod DB (the code reside on different branches in Git and we merge every two weeks). We want to start using Flyway for DB version control. Right now the idea is to create sql scripts on dev branch when we need a change, and run migrate on dev for every change we need. Then every two weeks when merge happens, the sql scripts will be merged to prod branch and then be run (using flyway migrate) using pipeline.
Does that sound like a good approach? Can anyone share some experience about it or suggest other approaches?
browsingThrough91
(11 rep)
Jan 12, 2020, 06:59 AM
1
votes
1
answers
1969
views
Sync'ing MySQL stored procedures to Git
Is there a decent way to sync MySQL database source code (ie: functions and stored procedures) to git? I'd like to be able to develop stored procedures within my IDE and version control them in git so I can easily move them between servers, and identify changes to the code. It would be great if I co...
Is there a decent way to sync MySQL database source code (ie: functions and stored procedures) to git?
I'd like to be able to develop stored procedures within my IDE and version control them in git so I can easily move them between servers, and identify changes to the code. It would be great if I could use git-hooks to auto update my stored procedures on push. It seems like a reasonable thing to want to do, but I don't see anyone doing things this way.
I'd rather not attempt to store a long SP in a migration, or something like Liquibase. Ideally, I'd like to store the pure SQL in my git repo.
Disclaimer: I'm a new DBA, so I may be missing something obvious.
blindsnowmobile
(113 rep)
May 4, 2019, 06:06 AM
• Last activity: Aug 14, 2019, 04:01 PM
3
votes
0
answers
551
views
Git as distributed and decentralized storrage with regard to ACID and CAP
When using [Git][1] to store documents distributed and decentralized it can be considered as a database. How would the ACID properties and the CAP theorem correspond to git in this case? I think one has to distinguish between a single repository and the whole network of repositories. ACID - for a si...
When using Git to store documents distributed and decentralized it can be considered as a database.
How would the ACID properties and the CAP theorem correspond to git in this case?
I think one has to distinguish between a single repository and the whole network of repositories.
ACID - for a single repository:
- **A** would be ok, as there are commits
- **C** depends on the use case and thus is not relevant
- **I** is the big question,
- if one is using only one branch that should be fine
- if one is considering multiple branches **I** would be fine if a rebase (resp. merge) without conflicts is possible to a master branch (or even all other branches) but is not fine if a rebase would result in a conflict.
- **D** depends on your hard disk but should generally be fine
ACID - for a distributed setup:
- would be the same as above plus, that **I** has to be seen with respect to all other clones on the network of repositories
CAP:
- **C**
- for a single repository this would be ok
- looking at a distributed setup this would only be true, if every read operation is preceded by a pull.
- **A** this would always be true since the local copy is always available
- **P** if a pull is not possible than one has to decide whether to sacrifice **A** or **C** (as in the PACELC theorem ). Also one can see if the majority of remote repositories is available and use some quorum approach.
(I understand the CAP-C more like the ACID-A, see https://dba.stackexchange.com/a/202125/147543)
Is this a valid interpretation of ACID and CAP as it is used in the database domain? Or is there already an ongoing discussion about Git with regard to ACID and CAP?
white_gecko
(139 rep)
Mar 23, 2018, 04:14 PM
5
votes
1
answers
1890
views
Visual Studio, GIT, and SQL Scripts
I am trying to figure out a way to have all of our random SQL scripts that we write under source control. I am already using SSDT for the database project. This is not for these sort of scripts. It is for all the other random queries that we run over time. Before we put them in a stored procedure. O...
I am trying to figure out a way to have all of our random SQL scripts that we write under source control. I am already using SSDT for the database project. This is not for these sort of scripts. It is for all the other random queries that we run over time. Before we put them in a stored procedure. Or the other scripts that just don't really fit as a SP.
How can I bring my non SSDT Sql scripts under source control using Visual Studio?
Anthony Genovese
(2067 rep)
Oct 18, 2017, 08:13 PM
• Last activity: Oct 23, 2017, 01:56 PM
Showing page 1 of 10 total questions