C
C#11mo ago
Snaccman

Delete Query Not Executing via Dapper

I have the following delete query running via Dbeaver works fine, running it through Dapper nothing happens and I'm at a lose for why
No description
3 Replies
Snaccman
SnaccmanOP11mo ago
Dapper execution. Count is zero and checking the db via dbeaver, can confirm nothing is deleted var count = await conn.ExecuteAsync(sql: sql, transaction: transaction, commandType: CommandType.Text); Ive checked connection strings, running as super user, no explicit transaction, running a simple delete where id = '' and that works fine I asked a SO question yesterday but haven't had anything useful back https://stackoverflow.com/questions/77863268/dapper-result-doesnt-match-pgadmin
DELETE
FROM leaderboard_guilds lg
USING (
SELECT
id,
guild_id,
snapshot_timestamp,
ROW_NUMBER() OVER (PARTITION BY guild_id, snapshot_timestamp::date ORDER BY id) AS row_num
FROM leaderboard_guilds
) rg
WHERE rg.row_num > 1
and rg.guild_id = lg.guild_id
and rg.snapshot_timestamp = lg.snapshot_timestamp
and rg.id = lg.id;
DELETE
FROM leaderboard_guilds lg
USING (
SELECT
id,
guild_id,
snapshot_timestamp,
ROW_NUMBER() OVER (PARTITION BY guild_id, snapshot_timestamp::date ORDER BY id) AS row_num
FROM leaderboard_guilds
) rg
WHERE rg.row_num > 1
and rg.guild_id = lg.guild_id
and rg.snapshot_timestamp = lg.snapshot_timestamp
and rg.id = lg.id;
Tvde1
Tvde111mo ago
in the screenshot there is a rollback being executed. Is that something to take a look at?
Snaccman
SnaccmanOP11mo ago
Thats just so it doesnt the data for debugging, you can see it deletes 2600 rows. Dapper does not delete anything
Want results from more Discord servers?
Add your server