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

table status of tul before and after vanilla import #144

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/pump/_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def status(self):
tables = self.all_tables()
for table in tables:
name = table[0]
count = self.fetch_one(f"SELECT COUNT(*) FROM {name}")
# Use double quotes for table names because some of them are in uppercase.
count = self.fetch_one(f"SELECT COUNT(*) FROM \"{name}\"")
d[name] = count
zero = ""
msg = ""
Expand Down
30 changes: 30 additions & 0 deletions src/table_difference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import logging

import settings
import tul_settings
from utils import init_logging, update_settings

_logger = logging.getLogger()

env = update_settings(settings.env, tul_settings.settings)
init_logging(_logger, env["log_file"])

import dspace # noqa
import pump

if __name__ == "__main__":
dspace_be = dspace.rest(
env["backend"]["endpoint"],
env["backend"]["user"],
env["backend"]["password"],
env["backend"]["authentication"]
)

_logger.info("Loading repo objects")

_logger.info("New instance database status:")
raw_db_7 = pump.db(env["db_dspace_7"])
raw_db_7.status()
_logger.info("Reference database dspace status:")
raw_db_tul = pump.db(env["db_tul"])
raw_db_tul.status()
35 changes: 35 additions & 0 deletions src/tul_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
from datetime import datetime
_this_dir = os.path.dirname(os.path.abspath(__file__))
ts = datetime.now().strftime("%Y_%m_%d__%H.%M.%S")

settings = {
"log_file": os.path.join(_this_dir, "../__logs", f"{ts}.txt"),

"resume_dir": "__temp/resume/",

"backend": {
"endpoint": "http://dev-5.pc:85/server/api/",
"user": "[email protected]",
"password": "admin",
"authentication": True,
},

"db_dspace_7": {
# CLARIN-DSpace 7 database
"name": "dspace",
"host": "localhost",
# careful - NON standard port
"port": 5435,
"user": "dspace",
"password": "dspace",
},

"db_tul": {
"name": "tul",
"host": "localhost",
"user": "postgres",
"password": "dspace",
"port": 5432,
}
}