question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transactions are used for dry runs, even though they have been disabled

See original GitHub issue

In the Resource class I fount the following line in the import_data method:

using_transactions = (use_transactions or dry_run) and supports_transactions

Now why does it use transactions for dry runs whenever transactions are supported, even though I have opted to disable transactions completely?

I have some pretty big imports (200k+ objects) that take a really long time with transactions. Is there a deeper reason why the line does not just read the following?:

using_transactions = use_transactions and supports_transactions

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
beruiccommented, Oct 29, 2019

@bmihelac can you reopen this one?

1reaction
clint74commented, Oct 24, 2019

It worked for me. The whole process was about 40 minutes before change, now 5 minutes. https://gist.github.com/clint74/bd74025e799bf7101a5471b08ecd1567

Dry run and no transactions combo makes save_m2m no-op:

https://github.com/django-import-export/django-import-export/blob/54232db4a511cc5f0b085c6bb192c3619f27e452/import_export/resources.py#L345-L359

Surely as you noticed this currently never happens as dry_run is always wrapped in transaction.

I am thinking about refactoring using_transactions = ... line so it retain current behaviour but can be changed to not use transactions in dry run as well.

using_transactions = supports_transactions and (
    use_transactions or
    (dry_run and self.use_transactions_in_dry_run())
)

Thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does Liquibase support dry run? - sql - Stack Overflow
I think your answer is "it does not support dry runs" but the problem is primarily with the database and not with liquibase....
Read more >
[Tour de SOL] Dry Run #1 Debrief - Validators - Solana Forums
Snapshots (for faster validator catch-up) were disabled due to some last minute bugs identified; GPUs not required as the goal was to sustain...
Read more >
pt-online-schema-change — Percona Toolkit Documentation
If --alter contain DROP PRIMARY KEY (case- and space-insensitive), a warning is printed and the tool exits unless --dry-run is specified. Altering the...
Read more >
11.13 - PostgreSQL: Release Notes
SSL renegotiation has been disabled for some time, but the server would still cooperate with a client-initiated renegotiation request.
Read more >
Ultra Packet Core CUPS Control Plane Administration Guide ...
The NSO configuration-handling caters to the following use cases: ... Dry-run file is named as <MOP File Name>-<Device Name>-dryrun.txt.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found