Skip to main content

Advanced Database Replace

Short description

A utility management library which runs an advanced search&replace action against a specified database's records (event if they are serialized).

Long description

This project aims to take search&replace to the next level by applying search&replace even to serialized records in the database. This type of project is especially effective against e.g. Wordpress databases since they may contain serialized PHP array records.

Prerequisites

  • A MySql database.
  • This project installed with:
pip install advanced_database_replace

or:

./install.sh

Usage

Replacing all occurrences on all tables

from advanced_database_replace.database_replace import DatabaseReplace
from advanced_database_replace.database_credentials import DatabaseCredentials

db_credentials = DatabaseCredentials()
db_replacer = DatabaseReplace(credentials=db_credentials)

db_replacer.replace_all('my-old-record', 'my-new-record')

Replacing all occurrences on a specific table

from advanced_database_replace.database_replace import DatabaseReplace
from advanced_database_replace.database_credentials import DatabaseCredentials

db_credentials = DatabaseCredentials()
db_replacer = DatabaseReplace(credentials=db_credentials)

db_replacer.replace('my-old-record', 'my-new-record', 'my-table')

Using custom serializer

Since (as mentioned in the description) this find&replace project handles serialized data, by default it assumes PHP serialization, however, you can provide a custom serializer.

from advanced_database_replace.database_replace import DatabaseReplace
from advanced_database_replace.database_credentials import DatabaseCredentials

class MyCustomSerializer:
    @staticmethod
    def dumps(*args, **kwargs):
        pass

    @staticmethod
    def loads(*args, **kwargs):
        pass

db_credentials = DatabaseCredentials()
db_replacer = DatabaseReplace(credentials=db_credentials, serializer=MyCustomSerializer())

db_replacer.replace_all('my-old-record', 'my-new-record')

Release history

1.0.0

Initial.

Metadata

Release files for advanced-database-replace 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for advanced-database-replace 1.0.0
File Size Uploaded Provenance
advanced_database_replace-1.0.0.tar.gz 16.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for advanced-database-replace 1.0.0
File Interpreter ABI Platform
advanced_database_replace-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.6 kB

Release files / advanced_database_replace-1.0.0.tar.gz

Download URL advanced_database_replace-1.0.0.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
632ec18152ac96466b2397ea35b09184b0b35ec2d1fe80e86dead7cb9b95e3fb
BLAKE2b-256 checksum
How to use checksums
ec5f9c1048451f3ead2edbd7aeb18eb5f475ba2009d0c202be81cf043db4d155
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.15+

Release files / advanced_database_replace-1.0.0-py3-none-any.whl

Download URL advanced_database_replace-1.0.0-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
681125785d400e950ff4c54fcec302fec6a4d6d6c9416a4d3f895a20b1ee748a
BLAKE2b-256 checksum
How to use checksums
3fa1f3174d9a8cd6efe6a387f1cff33218a39bcbdcb4ff0be982a32b7e08db87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.15+

Security for advanced-database-replace 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page