Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail when running migrate, runserver or other commands #9

Open
David-Wobrock opened this issue Jun 9, 2018 · 2 comments
Open

Fail when running migrate, runserver or other commands #9

David-Wobrock opened this issue Jun 9, 2018 · 2 comments
Assignees
Milestone

Comments

@David-Wobrock
Copy link
Owner

No description provided.

@David-Wobrock David-Wobrock self-assigned this Jun 9, 2018
@David-Wobrock David-Wobrock added this to the 0.2.0 milestone Jun 10, 2018
@jayvdb
Copy link

jayvdb commented Jun 14, 2020

To elaborate, with Django 3. I was hoping to use this as a fake db in combination with django-fake-model for a lightweight test harness.

/usr/lib/python3.8/site-packages/pytest_djangoapp/plugin.py:20: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.8/site-packages/django/test/runner.py:618: in setup_databases
    return _setup_databases(
/usr/lib/python3.8/site-packages/django/test/utils.py:170: in setup_databases
    connection.creation.create_test_db(
/usr/lib/python3.8/site-packages/django/db/backends/base/creation.py:65: in create_test_db
    call_command(
/usr/lib/python3.8/site-packages/django/core/management/__init__.py:168: in call_command
    return command.execute(*args, **defaults)
/usr/lib/python3.8/site-packages/django/core/management/base.py:394: in execute
    output = self.handle(*args, **options)
/usr/lib/python3.8/site-packages/django/core/management/base.py:89: in wrapped
    res = handle_func(*args, **kwargs)
/usr/lib/python3.8/site-packages/django/core/management/commands/migrate.py:244: in handle
    post_migrate_state = executor.migrate(
/usr/lib/python3.8/site-packages/django/db/migrations/executor.py:117: in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
/usr/lib/python3.8/site-packages/django/db/migrations/executor.py:147: in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
/usr/lib/python3.8/site-packages/django/db/migrations/executor.py:228: in apply_migration
    self.record_migration(migration)
/usr/lib/python3.8/site-packages/django/db/migrations/executor.py:243: in record_migration
    self.recorder.record_applied(migration.app_label, migration.name)
/usr/lib/python3.8/site-packages/django/db/migrations/recorder.py:87: in record_applied
    self.migration_qs.create(app=app, name=name)
/usr/lib/python3.8/site-packages/django/db/models/query.py:447: in create
    obj.save(force_insert=True, using=self.db)
/usr/lib/python3.8/site-packages/django/db/models/base.py:750: in save
    self.save_base(using=using, force_insert=force_insert,
/usr/lib/python3.8/site-packages/django/db/models/base.py:787: in save_base
    updated = self._save_table(
/usr/lib/python3.8/site-packages/django/db/models/base.py:892: in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
/usr/lib/python3.8/site-packages/django/db/models/base.py:930: in _do_insert
    return manager._insert(
/usr/lib/python3.8/site-packages/django/db/models/manager.py:85: in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
/usr/lib/python3.8/site-packages/django/db/models/query.py:1251: in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
/usr/lib/python3.8/site-packages/django/db/models/sql/compiler.py:1410: in execute_sql
    return [(self.connection.ops.last_insert_id(
/usr/lib/python3.8/site-packages/django/db/backends/base/operations.py:266: in last_insert_id
    return cursor.lastrowid
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <django.db.backends.utils.CursorWrapper object at 0x7f9b9b0f59a0>, attr = 'lastrowid'

    def __getattr__(self, attr):
>       cursor_attr = getattr(self.cursor, attr)
E       AttributeError: 'Cursor' object has no attribute 'lastrowid'

/usr/lib/python3.8/site-packages/django/db/backends/utils.py:22: AttributeError

@David-Wobrock
Copy link
Owner Author

Hi @jayvdb
Thanks for the comment and the interest for this project.
However, I pretty much discontinued it for now. I currently don't have the time, nor interest in pursuing it.

Nevertheless, feel free to fork and play around with it. Some new features and Django versions might not be too hard to support.
You can either work on your fork and maintain it - or suggest changes as PR to this project -- I'll try my best to incorporate them cleanly and release them if it can help you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants