Skip to content

Commit

Permalink
Merge pull request #4023 from mathesar-foundation/rm_sqlite
Browse files Browse the repository at this point in the history
Remove support for sqlite
  • Loading branch information
mathemancer authored Nov 13, 2024
2 parents 20b9906 + 5e02bee commit 5992623
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
8 changes: 2 additions & 6 deletions config/settings/common_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def pipe_delim(pipe_string):
}

# POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_HOST & POSTGRES_PORT are required env variables for forming a pg connection string for the django database
# lack of any one of these will result in the internal django database to be sqlite.
POSTGRES_DB = os.environ.get('POSTGRES_DB', default=None)
POSTGRES_USER = os.environ.get('POSTGRES_USER', default=None)
POSTGRES_PASSWORD = os.environ.get('POSTGRES_PASSWORD', default=None)
Expand All @@ -125,13 +124,10 @@ def pipe_delim(pipe_string):

if POSTGRES_DB and POSTGRES_USER and POSTGRES_PASSWORD and POSTGRES_HOST and POSTGRES_PORT:
DATABASES['default'] = db_url(f'postgres://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB}')
else:
DATABASES['default'] = db_url('sqlite:///db.sqlite3')

for db_key, db_dict in DATABASES.items():
# Engine should be '.postgresql' or '.postgresql_psycopg2' for all db(s),
# however for the internal 'default' db 'sqlite3' can be used.
if not db_dict['ENGINE'].startswith('django.db.backends.postgresql') and db_key != 'default':
# Engine should be '.postgresql' or '.postgresql_psycopg2' for all db(s)
if not db_dict['ENGINE'].startswith('django.db.backends.postgresql'):
raise ValueError(
f"{db_key} is not a PostgreSQL database. "
f"{db_dict['ENGINE']} found for {db_key}'s engine."
Expand Down
3 changes: 0 additions & 3 deletions docs/docs/user-guide/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ Every PostgreSQL database lives within a PostgreSQL server.

- The **Internal Server:** Most Mathesar installations have an internal PostgreSQL server which the Mathesar application controls and utilizes for storage of application-specific metadata.

!!! info "Some Mathesar installations don't have an internal server"
It's possible (though not recommended) to configure Mathesar to store its internal metadata in SQLite, thereby circumventing the need for an internal server.

## Creating a new database

If you're starting your database from scratch with Mathesar you can either:
Expand Down
2 changes: 0 additions & 2 deletions mathesar/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ def _get_internal_db_meta():
'port': internal_db['PORT'],
'database_name': internal_db['NAME']
}
else:
return {'type': 'sqlite'}


def get_common_data(request, database_id=None, schema_oid=None):
Expand Down

0 comments on commit 5992623

Please sign in to comment.