1. Overview#
This page explains gives a graphical overview of the tool.
1.1. DVC CLI commands and subcommands#
This section explains the client-facing side of the tool. The library is exposed via the commandline dvc.
![digraph cli {
graph [fontname="Verdana", fontsize="12"];
node [fontname="Verdana", fontsize="12"];
edge [fontname="Sans", fontsize="9"];
rankdir="LR";
dvc -> {cfg, db}
cfg -> {init, show}
db -> {ping, init, upgrade, downgrade}
}](../_images/graphviz-84e28f970925f6db9e98af4fa64c58ab879d8f51.png)
DVC CLI Commands and Subcommands#
1.2. Data Structures#
1.2.1. Core Structure#
This section explains the core of the tool. It shows the interaction between the classes (marked in yellow). Greyed out items are features yet to be implemented.
![digraph core {
graph [fontname="Verdana", fontsize="12"];
node [fontname="Verdana", fontsize="12"];
edge [fontname="Sans", fontsize="9"];
label = "Core";
env [label="Env Var"];
conffile [label="Config File"];
ConfigReader [label="ConfigReader", shape="class", color="yellow", style="filled"];
ConfigFileWriter [label="ConfigFileWriter", shape="class", color="yellow", style="filled"];
DatabaseRevisionFilesManager [label="DatabaseRevisionFilesManager", shape="class", color="yellow", style="filled"];
sqlfiles [label="SQL Files"];
subgraph cluster_0 {
label="SQLFileExecutors and Databases"
PostgresqlSQLFileExecutor[shape="class", color="yellow", style="filled"];
MysqlSQLFileExecutor[shape="class", color="grey", style="filled"];
BigquerySQLFileExecutor[shape="class", color="grey", style="filled"];
postgresql
mysql[color=grey, style="filled"];
bigquery[color=grey, style="filled"];
PostgresqlSQLFileExecutor -> postgresql[label="apply"]
MysqlSQLFileExecutor -> mysql[label="apply"]
BigquerySQLFileExecutor -> bigquery[label="apply"]
}
env -> ConfigReader[label="input"];
ConfigFileWriter -> conffile[label="generate"];
conffile -> ConfigReader[label="input"];
ConfigReader -> DatabaseRevisionFilesManager[label="input"];
DatabaseRevisionFilesManager -> sqlfiles[label="lookup"];
DatabaseRevisionFilesManager -> {PostgresqlSQLFileExecutor,MysqlSQLFileExecutor,BigquerySQLFileExecutor}[label="call"];
}](../_images/graphviz-67c97ecf6015c59ceca7751761fc477b693bc70b.png)
DVC Core structure#
1.2.2. DatabaseVersion and DatabaseRevisionFile#
Below is a series of graphs illustrating the relationship between
Current Database Version (DatabaseVersion)
Target Database Version (DatabaseVersion)
One or more Database Revision Files (DatabaseRevisionFiles)
![digraph core {
rankdir="LR";
curr_dbver [label="V1", shape="cylinder"];
tar_dbver [label="V2", shape="cylinder"];
dbrev_file [label="RV2, Upgrade", shape="note"];
subgraph cluster_0 {
{rank=same curr_dbver dbrev_file}
curr_dbver -> dbrev_file[label="plus", arrowhead="none"];
}
dbrev_file -> tar_dbver [ltail=cluster_0, lhead=tar_dbver];
}](../_images/graphviz-2714ff9b679a01b0a2734643790a842d89d77cc8.png)
V1 + RV2 (Upgrade) = V2#
![digraph core {
rankdir="LR";
curr_dbver [label="V1", shape="cylinder"];
tar_dbver [label="V0", shape="cylinder"];
dbrev_file [label="RV1, Downgrade", shape="note"];
subgraph cluster_0 {
{rank=same curr_dbver dbrev_file}
curr_dbver -> dbrev_file[label="plus", arrowhead="none"];
}
dbrev_file -> tar_dbver [ltail=cluster_0, lhead=tar_dbver];
}](../_images/graphviz-2283a702c6d6554df8bd07fbbc79962dda939815.png)
V1 + RV1 (Downgrade) = V0#
![digraph core {
rankdir="LR";
curr_dbver [label="V3", shape="cylinder"];
tar_dbver [label="V5", shape="cylinder"];
dbrev_file_1 [label="RV4, Upgrade", shape="note"];
dbrev_file_2 [label="RV5, Upgrade", shape="note"];
subgraph cluster_0 {
{rank=same curr_dbver tar_dbver}
tar_dbver -> curr_dbver[label="minus", arrowhead="none"];
}
subgraph cluster_ {
{rank=same dbrev_file_1 dbrev_file_2}
dbrev_file_1 -> dbrev_file_2[ arrowhead="none"];
}
curr_dbver -> dbrev_file_1 [ltail=cluster_0, lhead=cluster_1];
}](../_images/graphviz-f5b9e4f42438a6386994aca2039cb6e12b60f0e0.png)
V5 - V3 = [RV4 Upgrade + RV5 Upgrade]#
![digraph core {
rankdir="LR";
curr_dbver [label="V5", shape="cylinder"];
tar_dbver [label="V3", shape="cylinder"];
dbrev_file_1 [label="RV5, Downgrade", shape="note"];
dbrev_file_2 [label="RV4, Downgrade", shape="note"];
subgraph cluster_0 {
{rank=same curr_dbver tar_dbver}
tar_dbver -> curr_dbver[label="minus", arrowhead="none"];
}
subgraph cluster_ {
{rank=same dbrev_file_1 dbrev_file_2}
dbrev_file_1 -> dbrev_file_2[ arrowhead="none"];
}
curr_dbver -> dbrev_file_1 [ltail=cluster_0, lhead=cluster_1];
}](../_images/graphviz-1ff567b0f435eba4d3e0a4b2f7a0dbb54ea0c5db.png)
V3 - V5 = [RV5 Downgrade + RV4 Downgrade]#