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

Django migrations table build in geonode_data? #12424

Open
t-book opened this issue Jul 16, 2024 · 1 comment
Open

Django migrations table build in geonode_data? #12424

t-book opened this issue Jul 16, 2024 · 1 comment
Labels
question A User question which should be discussed at mailing list

Comments

@t-book
Copy link
Contributor

t-book commented Jul 16, 2024

Expected Behavior

The django_migrations table should live in database geonode?

Should this not read --database=default instead of --database=datastore?

f"python manage.py migrate --noinput --settings={_localsettings()} --database=datastore",

or is there some reason to keep migrations table in geonode_data?

Actual Behavior

The table is created in geonode_data.

Steps to Reproduce the Problem

  1. start a stack from master

root@47ce2c613e4a:/usr/src/geonode# ./manage.py shell --settings=geonode.settings

In [1]: from django.conf import settings

In [2]: settings.DATABASES

Out[2]: 
{'default': {'NAME': 'geonode',
  'USER': 'geonode',
  'PASSWORD': 'pass',
  'HOST': 'db',
  'PORT': 5432,
  'CONN_MAX_AGE': 0,
  'CONN_HEALTH_CHECKS': False,
  'ENGINE': 'django.contrib.gis.db.backends.postgis',
  'OPTIONS': {'connect_timeout': 5},
  'ATOMIC_REQUESTS': False,
  'AUTOCOMMIT': True,
  'TIME_ZONE': None,
  'TEST': {'CHARSET': None,
   'COLLATION': None,
   'MIGRATE': True,
   'MIRROR': None,
   'NAME': None}},
 'datastore': {'NAME': 'geonode_data',
  'USER': 'geonode_data',
  'PASSWORD': 'pass',
  'HOST': 'db',
  'PORT': 5432,
  'CONN_MAX_AGE': 0,
  'CONN_HEALTH_CHECKS': False,
  'ENGINE': 'django.contrib.gis.db.backends.postgis',
  'OPTIONS': {'connect_timeout': 5}}}



$ geonodeuser@v2202404222509265991:~/geonode$ docker compose exec db bash
$e2b97dad486e:/# psql -U postgres -d geonode_data

geonode_data=# \dt;
                     List of relations
 Schema |            Name            | Type  |    Owner     
--------+----------------------------+-------+--------------
 public | django_migrations          | table | geonode_data <-- in geonode_data ?
 public | dynamic_models_fieldschema | table | geonode_data
 public | dynamic_models_modelschema | table | geonode_data
 public | gf_adminrule               | table | geonode_data
 public | gf_gfuser                  | table | geonode_data
 public | gf_gsinstance              | table | geonode_data
 public | gf_gsuser                  | table | geonode_data
 public | gf_layer_attributes        | table | geonode_data
 public | gf_layer_details           | table | geonode_data
 public | gf_layer_styles            | table | geonode_data
 public | gf_rule                    | table | geonode_data
 public | gf_rule_limits             | table | geonode_data
 public | gf_user_usergroups         | table | geonode_data
 public | gf_usergroup               | table | geonode_data
 public | spatial_ref_sys            | table | postgres

Specifications

  • GeoNode version: master
  • Installation type (vanilla, geonode-project): vanilla
  • Installation method (manual, docker): docker
  • Platform: Ubuntu
  • Additional details:
@t-book t-book added the bug label Jul 16, 2024
@t-book t-book changed the title Django migrations table build in geonode_data Django migrations table build in geonode_data? Jul 16, 2024
@mattiagiupponi
Copy link
Contributor

mattiagiupponi commented Jul 22, 2024

HI @t-book
The migration to geonode-data is carried out by the geonode-importer tool. This importer not only handles the import process, but also enables the creation of dynamic models for each imported dataset. With this feature, the imported dataset can be directly queried from geonode, allowing users to navigate through the dataset data via Django.

Currently, the dynamic model feature is disabled by default, but it can be activated by adding the environment variable IMPORTER_ENABLE_DYN_MODELS. The migration on geonode-data is necessary for the dynamic model app. The Django-migration table is available there.

We can consider making the migration on geonode-data optional if the IMPORTER_ENABLE_DYN_MODELS is enabled.

@mattiagiupponi mattiagiupponi added question A User question which should be discussed at mailing list and removed bug labels Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A User question which should be discussed at mailing list
Projects
None yet
Development

No branches or pull requests

2 participants