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.

Unable to run shell for a specifc schema via tenant_command

See original GitHub issue

Environment:

  • Python=3.6
  • Django=3.0.2
  • django-rest-framework=3.11.0
  • django-tenant-schemas=1.10.0

I’m having trouble executing the shell command for a specific schema. Here is the command that I’m trying to run:

python manage.py tenant_command shell --schema=<SCHEMA_NAME>

And I’m getting this error:

Traceback (most recent call last):
  File "manage.py", line 25, in <module>
    main()
  File "manage.py", line 21, in main
    execute_from_command_line(sys.argv)
  File "/home/cypher/.virtualenvs/candi-server/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/home/cypher/.virtualenvs/candi-server/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/cypher/.virtualenvs/candi-server/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/cypher/.virtualenvs/candi-server/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/home/cypher/.virtualenvs/candi-server/lib/python3.6/site-packages/tenant_schemas/management/commands/tenant_command.py", line 15, in handle
    call_command(command, *args, **options)
  File "/home/cypher/.virtualenvs/candi-server/lib/python3.6/site-packages/django/core/management/__init__.py", line 160, in call_command
    ', '.join(sorted(valid_options)),
TypeError: Unknown option(s) for shell command: skip_checks. Valid options are: command, force_color, help, interface, no_color, no_startup, pythonpath, settings, stderr, stdout, traceback, verbosity, version.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

6reactions
sshahbajcommented, Apr 11, 2020

Looks like adding the requires_system_checks flag and setting it to False in tenant_command.py fixes the problem.

class Command(InteractiveTenantOption, BaseCommand):
    help = "Wrapper around django commands for use with an individual tenant"
    requires_system_checks = False

    def handle(self, command, schema_name, *args, **options):
        tenant = self.get_tenant_from_options_or_interactive(
            schema_name=schema_name, **options
        )
        connection.set_tenant(tenant)
        call_command(command, *args, **options)
0reactions
sshahbajcommented, Apr 29, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

django-tenants: Python shell with specific tenant
I want to use "./manage.
Read more >
Using django-tenant-schemas - Read the Docs
To run the command on a particular schema, there is an optional argument called --schema . If you omit the schema argument, the...
Read more >
Multitenant : Running Scripts Against Container Databases ...
The problem comes when you want to perform a task within the pluggable database. The simplest way to achieve this is to continue...
Read more >
Deploy resources to tenant - Azure - Microsoft Learn
Supported resources; Schema; Required access; Deployment commands ... The schema you use for tenant deployments is different than the schema ...
Read more >
Running bash scripts | Cloud Build Documentation
To run bash commands using the bash image, specify bash as the name of the ... that query Cloud Build for build status,...
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