From 80095fb314b8bffe08571df1051eada84c531a46 Mon Sep 17 00:00:00 2001 From: gabriellisboaconegero <gabriellisboaconegero@gmail.com> Date: Thu, 2 May 2024 10:48:24 -0300 Subject: [PATCH] fix: Using non local monetdb database MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mapear o arquivo que está na maquina local para a que esta na maquina/container do monetdb --- database/actions.py | 2 ++ settings.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/database/actions.py b/database/actions.py index 8563824..daf1c03 100644 --- a/database/actions.py +++ b/database/actions.py @@ -50,6 +50,8 @@ def temporary_data(connection, file_name, table, year, offset=2, ttable = table.get_temporary(header, year) ttable.create(bind=connection) + file_name = settings.db_env_file_path(file_name) + print("TESTE: ", file_name) table.populate_temporary(ttable, file_name, header, year, delimiters, null, offset, bind=connection) table.apply_derivatives(ttable, ttable.columns.keys(), year, bind=connection) diff --git a/settings.py b/settings.py index 36dd10f..75a4f5b 100644 --- a/settings.py +++ b/settings.py @@ -21,19 +21,22 @@ along with HOTMapper. If not, see <https://www.gnu.org/licenses/>. '''Settings used by the database module''' import logging +def db_env_file_path(file_name): + return file_name.replace('glc22', 'monetdb') + # SQL dialect used by sqlalchemy. DATABASE_DIALECT = 'monetdb' # Login credentials in database DATABASE_USER = 'monetdb' -DATABASE_USER_PASSWORD = 'monetdb' +DATABASE_USER_PASSWORD = '12345' # Host to connect to. Bulk inserts won't work remotely unless you can specify an # absolute path in the server DATABASE_HOST = 'localhost' # Database to connect to -DATABASE = 'hotmapper_demo' +DATABASE = 'treinamento' # Column used to run aggregations and denormalizations YEAR_COLUMN = 'ano_censo' -- GitLab