Thomas Guyot-Sionnest
2017-07-13 13:45:33 UTC
Hi,
Has anyone been successful at creating new PostgreSQL databases?
Besides Gramps insisting on replacing my en_CA locale to en_GB (which I
had to install for database creation to work, but more about this at the
bottom of this post), I encountered a few issues as well:
1. Port being ignored - I assume no ones uses custom ports, but my fix
goes further and converts all database.* as keyword args so I can also
set other things in config.ini such as sslmode='verify-full'
2. Empty db detection fails as the query in
gramps/plugins/db/dbapi/postgresql.py uses the wrong parameter type
3. Gramps trying to create BLOB columns - I added a _hack_query line to
convert to bitea
The error I'm getting now is this - I haven't had time to dig deeper...
2017-07-13 09:36:36.451: ERROR: dbloader.py: line 110: relation "person"
does not exist
Traceback (most recent call last):
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line
919, in _create_secondary_columns
% (field, table_name))
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/postgresql.py",
line 92, in execute
self.__cursor.execute(sql, args, **kwargs)
psycopg2.ProgrammingError: column "gender" does not exist
LIGNE 1 : SELECT gender FROM person LIMIT 1
^
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gramps/gui/dbloader.py", line
196, in read_file
force_python_upgrade)
File "/usr/lib/python3/dist-packages/gramps/gen/db/generic.py", line
591, in load
self._initialize(directory)
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line
124, in _initialize
self._create_schema()
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line
223, in _create_schema
self._create_secondary_columns()
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line
927, in _create_secondary_columns
% (table_name, field, sql_type))
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/postgresql.py",
line 92, in execute
self.__cursor.execute(sql, args, **kwargs)
psycopg2.ProgrammingError: relation "person" does not exist
Now back to locale, I see that gramps creates a collation for the user's
locale... I assume multiple users with different locales may connect. Is
that OK or shall we force the locale, ex by adding it to
settings.ini/.py? (i.e. force everyone on a single collation)
If we allow multiple collations, then right now gramps drops the old
collation and creates a new one on connect, so I guess we should only
create new collations and leave the others alone? I haven't really
player with SQL collations anyway so I'd really like some advice here.
Regards,
Has anyone been successful at creating new PostgreSQL databases?
Besides Gramps insisting on replacing my en_CA locale to en_GB (which I
had to install for database creation to work, but more about this at the
bottom of this post), I encountered a few issues as well:
1. Port being ignored - I assume no ones uses custom ports, but my fix
goes further and converts all database.* as keyword args so I can also
set other things in config.ini such as sslmode='verify-full'
2. Empty db detection fails as the query in
gramps/plugins/db/dbapi/postgresql.py uses the wrong parameter type
3. Gramps trying to create BLOB columns - I added a _hack_query line to
convert to bitea
The error I'm getting now is this - I haven't had time to dig deeper...
2017-07-13 09:36:36.451: ERROR: dbloader.py: line 110: relation "person"
does not exist
Traceback (most recent call last):
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line
919, in _create_secondary_columns
% (field, table_name))
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/postgresql.py",
line 92, in execute
self.__cursor.execute(sql, args, **kwargs)
psycopg2.ProgrammingError: column "gender" does not exist
LIGNE 1 : SELECT gender FROM person LIMIT 1
^
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gramps/gui/dbloader.py", line
196, in read_file
force_python_upgrade)
File "/usr/lib/python3/dist-packages/gramps/gen/db/generic.py", line
591, in load
self._initialize(directory)
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line
124, in _initialize
self._create_schema()
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line
223, in _create_schema
self._create_secondary_columns()
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line
927, in _create_secondary_columns
% (table_name, field, sql_type))
File
"/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/postgresql.py",
line 92, in execute
self.__cursor.execute(sql, args, **kwargs)
psycopg2.ProgrammingError: relation "person" does not exist
Now back to locale, I see that gramps creates a collation for the user's
locale... I assume multiple users with different locales may connect. Is
that OK or shall we force the locale, ex by adding it to
settings.ini/.py? (i.e. force everyone on a single collation)
If we allow multiple collations, then right now gramps drops the old
collation and creates a new one on connect, so I guess we should only
create new collations and leave the others alone? I haven't really
player with SQL collations anyway so I'd really like some advice here.
Regards,
--
Thomas
Thomas