bird0401 / Visual-Entity-Linking

image recognition in instance level
0 stars 0 forks source link

DB memo #38

Open bird0401 opened 2 years ago

bird0401 commented 2 years ago

Reference

Design

Query

bird0401 commented 2 years ago

command to delete binary files except newest one

mysql> PURGE BINARY LOGS TO 'mysql-bin.000142';

bird0401 commented 2 years ago

I cant apply DB backup periodically using cron command because I dont have root authentification on the server

bird0401 commented 2 years ago

binary log

to find my.conf,

mysql --help | grep my.cnf

bird0401 commented 2 years ago

Main purpose of using DB is not to download existing images by searching DB if there is the image URI

need columns

tables

img_urls

names

img_wikidata_id

img_path

Others

bird0401 commented 2 years ago

dont use zabbix because I dont have root authenticaton on ist-cluster and no client

bird0401 commented 2 years ago
CREATE DATABASE scraping_dog_breeds_by_name CHARACTER SET utf8;
CREATE TABLE names(
    wikidata_id CHAR(20) NOT NULL PRIMARY KEY,
    name VARCHAR(200) CHARACTER SET utf8 NOT NULL 
);

CREATE TABLE img_urls (
    img_id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    wikidata_id CHAR(20) NOT NULL,
    img_url VARCHAR(2048) CHARACTER SET utf8 NOT NULL
);

CREATE TABLE img_wikidata_id (
    img_id MEDIUMINT NOT NULL,
    wikidata_id CHAR(20) NOT NULL,
    PRIMARY KEY(img_id, wikidata_id),
    FOREIGN KEY(img_id) 
        REFERENCES img_urls(img_id)
        ON UPDATE CASCADE ON DELETE CASCADE,
    FOREIGN KEY(wikidata_id) 
        REFERENCES names(wikidata_id)
        ON UPDATE CASCADE ON DELETE CASCADE
);

CREATE TABLE img_path (
    img_id MEDIUMINT NOT NULL PRIMARY KEY,
    path VARCHAR(50) NOT NULL,
    FOREIGN KEY(img_id) 
        REFERENCES img_urls(img_id)
        ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE USER 'scraper' IDENTIFIED BY $mysql_pass;
GRANT ALL ON *.* TO 'scraper';
bird0401 commented 1 year ago

mysql or BQ