Creation API

class django_spanner.creation.DatabaseCreation(connection)[source]

Spanner-specific wrapper for Django class encapsulating methods for creation and destruction of the underlying test database.

clone_test_db(suffix, verbosity=1, autoclobber=False, keepdb=False)

Clone a test database.

create_test_db(*args, **kwargs)[source]

Create a test database.

Return type

str

Returns

The name of the newly created test Database.

deserialize_db_from_string(data)

Reload the database with data from a string generated by the serialize_db_to_string() method.

destroy_test_db(old_database_name=None, verbosity=1, keepdb=False, suffix=None)

Destroy a test database, prompting the user for confirmation if the database already exists.

get_test_db_clone_settings(suffix)

Return a modified connection settings dict for the n-th clone of a DB.

mark_expected_failures_and_skips()

Mark tests in Django’s test suite which are expected failures on this database and test which should be skipped on this database.

mark_skips()[source]

Skip tests that don’t work on Spanner.

serialize_db_to_string()

Serialize all data in the database into a JSON string. Designed only for test runner usage; will not handle large amounts of data.

set_as_test_mirror(primary_settings_dict)

Set this database up to be used in testing as a mirror of a primary database whose settings are given.

sql_table_creation_suffix()

SQL to append to the end of the test table creation statements.

test_db_signature()

Return a tuple with elements of self.connection.settings_dict (a DATABASES setting value) that uniquely identify a database accordingly to the RDBMS particularities.