You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Model with non-numeric primary key will fail because of mod annotations. model.objects.annotate( mod_pk=F('pk') % settings_with_fallback('SCRUBBER_ENTRIES_PER_PROVIDER') ).update(**realized_scrubbers)
What I Did
class Token(models.Model):
key = models.CharField(_("Key"), max_length=40, primary_key=True)
user = models.OneToOneField(
settings.AUTH_USER_MODEL, related_name='external_auth_token',
on_delete=models.CASCADE, verbose_name=_("User")
)
created = models.DateTimeField(_("Created"), auto_now_add=True)
class Scrubbers:
key = scrubbers.Concat(scrubbers.Hash('key'), scrubbers.Faker('pystr', min_chars=5, max_chars=15))
Running scrub_data will fail with this log:
psycopg2.errors.UndefinedFunction: operator does not exist: character varying % integer
django.db.utils.ProgrammingError: operator does not exist: character varying % integer
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
The text was updated successfully, but these errors were encountered:
@mounirmesselmeni This is a bit tricky, because we need some way to consistently map faked content to the scrubbed model's rows. The current "naive" way of doing pk % len(fakes) is pretty fast and easy, but only works for numbers.
Maybe we could add some option to convert the key to an int with something like ABS(('x'||MD5(XXX))::BIT(64)::BIGINT) (where XXX is the field name). This probably has a performance impact and should therefore be optional.
Description
Model with non-numeric primary key will fail because of mod annotations.
model.objects.annotate( mod_pk=F('pk') % settings_with_fallback('SCRUBBER_ENTRIES_PER_PROVIDER') ).update(**realized_scrubbers)
What I Did
Running scrub_data will fail with this log:
psycopg2.errors.UndefinedFunction: operator does not exist: character varying % integer
django.db.utils.ProgrammingError: operator does not exist: character varying % integer
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
The text was updated successfully, but these errors were encountered: