From fd7b3e5c5a7040f6d658d5d95f3294d77995ec27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Fri, 17 Jun 2022 03:43:55 +0200 Subject: [PATCH 01/23] Draft learning from MySQL --- R/learn.R | 2 +- R/meta.R | 47 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/R/learn.R b/R/learn.R index 67e93192d..b90797258 100644 --- a/R/learn.R +++ b/R/learn.R @@ -58,7 +58,7 @@ dm_learn_from_db <- function(dest, dbname = NA, schema = NULL, name_format = "{t from <- df_info$tables %>% - select(catalog = table_catalog, schema = table_schema, table = table_name) %>% + select(schema = table_schema, table = table_name) %>% pmap_chr(~ DBI::dbQuoteIdentifier(con, DBI::Id(...))) df_key_info <- diff --git a/R/meta.R b/R/meta.R index 70a50efd1..f5a32ab51 100644 --- a/R/meta.R +++ b/R/meta.R @@ -46,8 +46,7 @@ dm_meta_raw <- function(con, catalog) { local_options(digits.secs = 6) schemata <- tbl_lc(src, "information_schema.schemata", vars = c( - "catalog_name", "schema_name", "schema_owner", "default_character_set_catalog", - "default_character_set_schema", "default_character_set_name" + "catalog_name", "schema_name", "default_character_set_name" )) tables <- tbl_lc(src, "information_schema.tables", vars = c( "table_catalog", "table_schema", "table_name", "table_type" @@ -56,16 +55,15 @@ dm_meta_raw <- function(con, catalog) { "table_catalog", "table_schema", "table_name", "column_name", "ordinal_position", "column_default", "is_nullable", "data_type", "character_maximum_length", "character_octet_length", "numeric_precision", - "numeric_precision_radix", "numeric_scale", "datetime_precision", - "character_set_catalog", "character_set_schema", "character_set_name", - "collation_catalog", "collation_schema", "collation_name", "domain_catalog", - "domain_schema", "domain_name" + "numeric_scale", "datetime_precision", + "character_set_name", + "collation_name" )) table_constraints <- tbl_lc(src, "information_schema.table_constraints", vars = c( "constraint_catalog", "constraint_schema", "constraint_name", - "table_catalog", "table_schema", "table_name", "constraint_type", - "is_deferrable", "initially_deferred" - )) + "table_name", "constraint_type" + )) %>% + mutate(table_catalog = constraint_catalog, table_schema = constraint_schema, .before = table_name) key_column_usage <- tbl_lc(src, "information_schema.key_column_usage", vars = c( "constraint_catalog", "constraint_schema", "constraint_name", "table_catalog", "table_schema", "table_name", "column_name", @@ -82,6 +80,20 @@ dm_meta_raw <- function(con, catalog) { )) } else if (is_mssql(src)) { constraint_column_usage <- mssql_constraint_column_usage(src, table_constraints, catalog) + } else { + constraint_column_usage <- + tbl_lc(src, "information_schema.key_column_usage", vars = c( + "table_catalog", + "referenced_table_schema", "referenced_table_name", "referenced_column_name", + "constraint_catalog", "constraint_schema", "constraint_name", + "ordinal_position" + )) %>% + filter(!is.na(referenced_table_name)) %>% + rename( + table_schema = referenced_table_schema, + table_name = referenced_table_name, + column_name = referenced_column_name, + ) } dm(schemata, tables, columns, table_constraints, key_column_usage, constraint_column_usage) %>% @@ -145,13 +157,18 @@ dm_meta_simple_add_keys <- function(dm_meta) { } tbl_lc <- function(con, name, vars) { - from <- paste0( - "SELECT ", - paste0(DBI::dbQuoteIdentifier(con_from_src_or_con(con), vars), collapse = ", "), - "\nFROM ", name - ) + # For discovery only! + if (is.null(vars)) { + from <- name + } else { + from <- sql(paste0( + "SELECT ", + paste0(DBI::dbQuoteIdentifier(con_from_src_or_con(con), vars), collapse = ", "), + "\nFROM ", name + )) + } - tbl(con, sql(from), vars = vars) + tbl(con, from, vars = vars) } select_dm_meta <- function(dm_meta) { From 07599848f22aaf461be9da67766576c8045652df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 18 Jun 2022 08:10:51 +0200 Subject: [PATCH 02/23] Keep optional fields as a comment --- R/meta.R | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/R/meta.R b/R/meta.R index f5a32ab51..110ee6d72 100644 --- a/R/meta.R +++ b/R/meta.R @@ -45,19 +45,26 @@ dm_meta_raw <- function(con, catalog) { local_options(digits.secs = 6) - schemata <- tbl_lc(src, "information_schema.schemata", vars = c( - "catalog_name", "schema_name", "default_character_set_name" + schemata <- tbl_lc(src, "information_schema.schemata", vars = vec_c( + "catalog_name", "schema_name", "default_character_set_name", + # Optional, not MySQL: + # "schema_owner", "default_character_set_catalog", "default_character_set_schema", )) - tables <- tbl_lc(src, "information_schema.tables", vars = c( - "table_catalog", "table_schema", "table_name", "table_type" + tables <- tbl_lc(src, "information_schema.tables", vars = vec_c( + "table_catalog", "table_schema", "table_name", "table_type", )) - columns <- tbl_lc(src, "information_schema.columns", vars = c( + columns <- tbl_lc(src, "information_schema.columns", vars = vec_c( "table_catalog", "table_schema", "table_name", "column_name", "ordinal_position", "column_default", "is_nullable", "data_type", "character_maximum_length", "character_octet_length", "numeric_precision", "numeric_scale", "datetime_precision", - "character_set_name", - "collation_name" + "character_set_name", "collation_name", + + # Optional, not RMySQL: + # "numeric_precision_radix", + # "character_set_catalog", "character_set_schema", + # "collation_catalog", "collation_schema", "domain_catalog", + # "domain_schema", "domain_name" )) table_constraints <- tbl_lc(src, "information_schema.table_constraints", vars = c( "constraint_catalog", "constraint_schema", "constraint_name", From 2c6efdaf5a9889d28f482f75ca9c0be2ad57cabc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 18 Jun 2022 08:13:05 +0200 Subject: [PATCH 03/23] Special-case MariaDB --- R/meta.R | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/R/meta.R b/R/meta.R index 110ee6d72..8ff44ffc7 100644 --- a/R/meta.R +++ b/R/meta.R @@ -66,11 +66,20 @@ dm_meta_raw <- function(con, catalog) { # "collation_catalog", "collation_schema", "domain_catalog", # "domain_schema", "domain_name" )) - table_constraints <- tbl_lc(src, "information_schema.table_constraints", vars = c( - "constraint_catalog", "constraint_schema", "constraint_name", - "table_name", "constraint_type" - )) %>% - mutate(table_catalog = constraint_catalog, table_schema = constraint_schema, .before = table_name) + + if (is_mariadb(src)) { + table_constraints <- tbl_lc(src, "information_schema.table_constraints", vars = vec_c( + "constraint_catalog", "constraint_schema", "constraint_name", + "table_name", "constraint_type" + )) %>% + mutate(table_catalog = constraint_catalog, table_schema = constraint_schema, .before = table_name) + } else { + table_constraints <- tbl_lc(src, "information_schema.table_constraints", vars = vec_c( + "constraint_catalog", "constraint_schema", "constraint_name", + "table_catalog", "table_schema", "table_name", "constraint_type", + "is_deferrable", "initially_deferred", + )) + } key_column_usage <- tbl_lc(src, "information_schema.key_column_usage", vars = c( "constraint_catalog", "constraint_schema", "constraint_name", "table_catalog", "table_schema", "table_name", "column_name", From 44566cfeb90247979b641c35b549566926d5412e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 18 Jun 2022 01:42:45 +0200 Subject: [PATCH 04/23] Works better with new RMariaDB --- DESCRIPTION | 2 +- R/learn.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6d99c4fdd..fd12c05e9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -78,7 +78,7 @@ Suggests: pixarfilms, pool, progress, - RMariaDB (>= 1.0.10), + RMariaDB (>= 1.2.2), rmarkdown, RPostgres, RSQLite (>= 2.2.8), diff --git a/R/learn.R b/R/learn.R index b90797258..67e93192d 100644 --- a/R/learn.R +++ b/R/learn.R @@ -58,7 +58,7 @@ dm_learn_from_db <- function(dest, dbname = NA, schema = NULL, name_format = "{t from <- df_info$tables %>% - select(schema = table_schema, table = table_name) %>% + select(catalog = table_catalog, schema = table_schema, table = table_name) %>% pmap_chr(~ DBI::dbQuoteIdentifier(con, DBI::Id(...))) df_key_info <- From 683dfd801ce9092db7269bc8af855696dc5bee62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 18 Jun 2022 08:13:39 +0200 Subject: [PATCH 05/23] Fix unique PK constraint names, add snapshot --- R/meta.R | 24 +- tests/testthat/_snaps/maria/meta/columns.csv | 781 +++++++++++++++++++ 2 files changed, 802 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/_snaps/maria/meta/columns.csv diff --git a/R/meta.R b/R/meta.R index 8ff44ffc7..27a40fe01 100644 --- a/R/meta.R +++ b/R/meta.R @@ -72,7 +72,8 @@ dm_meta_raw <- function(con, catalog) { "constraint_catalog", "constraint_schema", "constraint_name", "table_name", "constraint_type" )) %>% - mutate(table_catalog = constraint_catalog, table_schema = constraint_schema, .before = table_name) + mutate(table_catalog = constraint_catalog, table_schema = constraint_schema, .before = table_name) %>% + mutate(constraint_name = if_else(constraint_type == "PRIMARY KEY", paste0("pk_", table_name), constraint_name)) } else { table_constraints <- tbl_lc(src, "information_schema.table_constraints", vars = vec_c( "constraint_catalog", "constraint_schema", "constraint_name", @@ -80,10 +81,11 @@ dm_meta_raw <- function(con, catalog) { "is_deferrable", "initially_deferred", )) } - key_column_usage <- tbl_lc(src, "information_schema.key_column_usage", vars = c( + + key_column_usage <- tbl_lc(src, "information_schema.key_column_usage", vars = vec_c( "constraint_catalog", "constraint_schema", "constraint_name", "table_catalog", "table_schema", "table_name", "column_name", - "ordinal_position" + "ordinal_position", )) if (is_postgres(src)) { @@ -97,6 +99,22 @@ dm_meta_raw <- function(con, catalog) { } else if (is_mssql(src)) { constraint_column_usage <- mssql_constraint_column_usage(src, table_constraints, catalog) } else { + # Alternate constraint names for uniqueness + key_column_usage <- + key_column_usage %>% + left_join( + tbl_lc(src, "information_schema.table_constraints", vars = vec_c( + "constraint_catalog", "constraint_schema", "constraint_name", + "table_name", "constraint_type" + )), + by = vec_c( + "constraint_catalog", "constraint_schema", "constraint_name", + "table_name", + ) + ) %>% + mutate(constraint_name = if_else(constraint_type == "PRIMARY KEY", paste0("pk_", table_name), constraint_name)) %>% + select(-constraint_type) + constraint_column_usage <- tbl_lc(src, "information_schema.key_column_usage", vars = c( "table_catalog", diff --git a/tests/testthat/_snaps/maria/meta/columns.csv b/tests/testthat/_snaps/maria/meta/columns.csv new file mode 100644 index 000000000..5053a2d26 --- /dev/null +++ b/tests/testthat/_snaps/maria/meta/columns.csv @@ -0,0 +1,781 @@ +"","table_schema","table_name","column_name","ordinal_position","column_default","is_nullable","data_type" +"1","information_schema","ALL_PLUGINS","PLUGIN_NAME",1,"''","NO","varchar" +"2","information_schema","ALL_PLUGINS","PLUGIN_VERSION",2,"''","NO","varchar" +"3","information_schema","ALL_PLUGINS","PLUGIN_STATUS",3,"''","NO","varchar" +"4","information_schema","ALL_PLUGINS","PLUGIN_TYPE",4,"''","NO","varchar" +"5","information_schema","ALL_PLUGINS","PLUGIN_TYPE_VERSION",5,"''","NO","varchar" +"6","information_schema","ALL_PLUGINS","PLUGIN_LIBRARY",6,"NULL","YES","varchar" +"7","information_schema","ALL_PLUGINS","PLUGIN_LIBRARY_VERSION",7,"NULL","YES","varchar" +"8","information_schema","ALL_PLUGINS","PLUGIN_AUTHOR",8,"NULL","YES","varchar" +"9","information_schema","ALL_PLUGINS","PLUGIN_DESCRIPTION",9,"NULL","YES","longtext" +"10","information_schema","ALL_PLUGINS","PLUGIN_LICENSE",10,"''","NO","varchar" +"11","information_schema","ALL_PLUGINS","LOAD_OPTION",11,"''","NO","varchar" +"12","information_schema","ALL_PLUGINS","PLUGIN_MATURITY",12,"''","NO","varchar" +"13","information_schema","ALL_PLUGINS","PLUGIN_AUTH_VERSION",13,"NULL","YES","varchar" +"14","information_schema","APPLICABLE_ROLES","GRANTEE",1,"''","NO","varchar" +"15","information_schema","APPLICABLE_ROLES","ROLE_NAME",2,"''","NO","varchar" +"16","information_schema","APPLICABLE_ROLES","IS_GRANTABLE",3,"''","NO","varchar" +"17","information_schema","APPLICABLE_ROLES","IS_DEFAULT",4,"NULL","YES","varchar" +"18","information_schema","CHARACTER_SETS","CHARACTER_SET_NAME",1,"''","NO","varchar" +"19","information_schema","CHARACTER_SETS","DEFAULT_COLLATE_NAME",2,"''","NO","varchar" +"20","information_schema","CHARACTER_SETS","DESCRIPTION",3,"''","NO","varchar" +"21","information_schema","CHARACTER_SETS","MAXLEN",4,"0","NO","bigint" +"22","information_schema","CHECK_CONSTRAINTS","CONSTRAINT_CATALOG",1,"''","NO","varchar" +"23","information_schema","CHECK_CONSTRAINTS","CONSTRAINT_SCHEMA",2,"''","NO","varchar" +"24","information_schema","CHECK_CONSTRAINTS","TABLE_NAME",3,"''","NO","varchar" +"25","information_schema","CHECK_CONSTRAINTS","CONSTRAINT_NAME",4,"''","NO","varchar" +"26","information_schema","CHECK_CONSTRAINTS","LEVEL",5,"''","NO","varchar" +"27","information_schema","CHECK_CONSTRAINTS","CHECK_CLAUSE",6,"''","NO","longtext" +"28","information_schema","CLIENT_STATISTICS","CLIENT",1,"''","NO","varchar" +"29","information_schema","CLIENT_STATISTICS","TOTAL_CONNECTIONS",2,"0","NO","bigint" +"30","information_schema","CLIENT_STATISTICS","CONCURRENT_CONNECTIONS",3,"0","NO","bigint" +"31","information_schema","CLIENT_STATISTICS","CONNECTED_TIME",4,"0","NO","bigint" +"32","information_schema","CLIENT_STATISTICS","BUSY_TIME",5,"0","NO","double" +"33","information_schema","CLIENT_STATISTICS","CPU_TIME",6,"0","NO","double" +"34","information_schema","CLIENT_STATISTICS","BYTES_RECEIVED",7,"0","NO","bigint" +"35","information_schema","CLIENT_STATISTICS","BYTES_SENT",8,"0","NO","bigint" +"36","information_schema","CLIENT_STATISTICS","BINLOG_BYTES_WRITTEN",9,"0","NO","bigint" +"37","information_schema","CLIENT_STATISTICS","ROWS_READ",10,"0","NO","bigint" +"38","information_schema","CLIENT_STATISTICS","ROWS_SENT",11,"0","NO","bigint" +"39","information_schema","CLIENT_STATISTICS","ROWS_DELETED",12,"0","NO","bigint" +"40","information_schema","CLIENT_STATISTICS","ROWS_INSERTED",13,"0","NO","bigint" +"41","information_schema","CLIENT_STATISTICS","ROWS_UPDATED",14,"0","NO","bigint" +"42","information_schema","CLIENT_STATISTICS","SELECT_COMMANDS",15,"0","NO","bigint" +"43","information_schema","CLIENT_STATISTICS","UPDATE_COMMANDS",16,"0","NO","bigint" +"44","information_schema","CLIENT_STATISTICS","OTHER_COMMANDS",17,"0","NO","bigint" +"45","information_schema","CLIENT_STATISTICS","COMMIT_TRANSACTIONS",18,"0","NO","bigint" +"46","information_schema","CLIENT_STATISTICS","ROLLBACK_TRANSACTIONS",19,"0","NO","bigint" +"47","information_schema","CLIENT_STATISTICS","DENIED_CONNECTIONS",20,"0","NO","bigint" +"48","information_schema","CLIENT_STATISTICS","LOST_CONNECTIONS",21,"0","NO","bigint" +"49","information_schema","CLIENT_STATISTICS","ACCESS_DENIED",22,"0","NO","bigint" +"50","information_schema","CLIENT_STATISTICS","EMPTY_QUERIES",23,"0","NO","bigint" +"51","information_schema","CLIENT_STATISTICS","TOTAL_SSL_CONNECTIONS",24,"0","NO","bigint" +"52","information_schema","CLIENT_STATISTICS","MAX_STATEMENT_TIME_EXCEEDED",25,"0","NO","bigint" +"53","information_schema","COLLATIONS","COLLATION_NAME",1,"''","NO","varchar" +"54","information_schema","COLLATIONS","CHARACTER_SET_NAME",2,"''","NO","varchar" +"55","information_schema","COLLATIONS","ID",3,"0","NO","bigint" +"56","information_schema","COLLATIONS","IS_DEFAULT",4,"''","NO","varchar" +"57","information_schema","COLLATIONS","IS_COMPILED",5,"''","NO","varchar" +"58","information_schema","COLLATIONS","SORTLEN",6,"0","NO","bigint" +"59","information_schema","COLLATION_CHARACTER_SET_APPLICABILITY","COLLATION_NAME",1,"''","NO","varchar" +"60","information_schema","COLLATION_CHARACTER_SET_APPLICABILITY","CHARACTER_SET_NAME",2,"''","NO","varchar" +"61","information_schema","COLUMNS","TABLE_CATALOG",1,"''","NO","varchar" +"62","information_schema","COLUMNS","TABLE_SCHEMA",2,"''","NO","varchar" +"63","information_schema","COLUMNS","TABLE_NAME",3,"''","NO","varchar" +"64","information_schema","COLUMNS","COLUMN_NAME",4,"''","NO","varchar" +"65","information_schema","COLUMNS","ORDINAL_POSITION",5,"0","NO","bigint" +"66","information_schema","COLUMNS","COLUMN_DEFAULT",6,"NULL","YES","longtext" +"67","information_schema","COLUMNS","IS_NULLABLE",7,"''","NO","varchar" +"68","information_schema","COLUMNS","DATA_TYPE",8,"''","NO","varchar" +"69","information_schema","COLUMNS","CHARACTER_MAXIMUM_LENGTH",9,"NULL","YES","bigint" +"70","information_schema","COLUMNS","CHARACTER_OCTET_LENGTH",10,"NULL","YES","bigint" +"71","information_schema","COLUMNS","NUMERIC_PRECISION",11,"NULL","YES","bigint" +"72","information_schema","COLUMNS","NUMERIC_SCALE",12,"NULL","YES","bigint" +"73","information_schema","COLUMNS","DATETIME_PRECISION",13,"NULL","YES","bigint" +"74","information_schema","COLUMNS","CHARACTER_SET_NAME",14,"NULL","YES","varchar" +"75","information_schema","COLUMNS","COLLATION_NAME",15,"NULL","YES","varchar" +"76","information_schema","COLUMNS","COLUMN_TYPE",16,"''","NO","longtext" +"77","information_schema","COLUMNS","COLUMN_KEY",17,"''","NO","varchar" +"78","information_schema","COLUMNS","EXTRA",18,"''","NO","varchar" +"79","information_schema","COLUMNS","PRIVILEGES",19,"''","NO","varchar" +"80","information_schema","COLUMNS","COLUMN_COMMENT",20,"''","NO","varchar" +"81","information_schema","COLUMNS","IS_GENERATED",21,"''","NO","varchar" +"82","information_schema","COLUMNS","GENERATION_EXPRESSION",22,"NULL","YES","longtext" +"83","information_schema","COLUMN_PRIVILEGES","GRANTEE",1,"''","NO","varchar" +"84","information_schema","COLUMN_PRIVILEGES","TABLE_CATALOG",2,"''","NO","varchar" +"85","information_schema","COLUMN_PRIVILEGES","TABLE_SCHEMA",3,"''","NO","varchar" +"86","information_schema","COLUMN_PRIVILEGES","TABLE_NAME",4,"''","NO","varchar" +"87","information_schema","COLUMN_PRIVILEGES","COLUMN_NAME",5,"''","NO","varchar" +"88","information_schema","COLUMN_PRIVILEGES","PRIVILEGE_TYPE",6,"''","NO","varchar" +"89","information_schema","COLUMN_PRIVILEGES","IS_GRANTABLE",7,"''","NO","varchar" +"90","information_schema","ENABLED_ROLES","ROLE_NAME",1,"NULL","YES","varchar" +"91","information_schema","ENGINES","ENGINE",1,"''","NO","varchar" +"92","information_schema","ENGINES","SUPPORT",2,"''","NO","varchar" +"93","information_schema","ENGINES","COMMENT",3,"''","NO","varchar" +"94","information_schema","ENGINES","TRANSACTIONS",4,"NULL","YES","varchar" +"95","information_schema","ENGINES","XA",5,"NULL","YES","varchar" +"96","information_schema","ENGINES","SAVEPOINTS",6,"NULL","YES","varchar" +"97","information_schema","EVENTS","EVENT_CATALOG",1,"''","NO","varchar" +"98","information_schema","EVENTS","EVENT_SCHEMA",2,"''","NO","varchar" +"99","information_schema","EVENTS","EVENT_NAME",3,"''","NO","varchar" +"100","information_schema","EVENTS","DEFINER",4,"''","NO","varchar" +"101","information_schema","EVENTS","TIME_ZONE",5,"''","NO","varchar" +"102","information_schema","EVENTS","EVENT_BODY",6,"''","NO","varchar" +"103","information_schema","EVENTS","EVENT_DEFINITION",7,"''","NO","longtext" +"104","information_schema","EVENTS","EVENT_TYPE",8,"''","NO","varchar" +"105","information_schema","EVENTS","EXECUTE_AT",9,"NULL","YES","datetime" +"106","information_schema","EVENTS","INTERVAL_VALUE",10,"NULL","YES","varchar" +"107","information_schema","EVENTS","INTERVAL_FIELD",11,"NULL","YES","varchar" +"108","information_schema","EVENTS","SQL_MODE",12,"''","NO","varchar" +"109","information_schema","EVENTS","STARTS",13,"NULL","YES","datetime" +"110","information_schema","EVENTS","ENDS",14,"NULL","YES","datetime" +"111","information_schema","EVENTS","STATUS",15,"''","NO","varchar" +"112","information_schema","EVENTS","ON_COMPLETION",16,"''","NO","varchar" +"113","information_schema","EVENTS","CREATED",17,"'0000-00-00 00:00:00'","NO","datetime" +"114","information_schema","EVENTS","LAST_ALTERED",18,"'0000-00-00 00:00:00'","NO","datetime" +"115","information_schema","EVENTS","LAST_EXECUTED",19,"NULL","YES","datetime" +"116","information_schema","EVENTS","EVENT_COMMENT",20,"''","NO","varchar" +"117","information_schema","EVENTS","ORIGINATOR",21,"0","NO","bigint" +"118","information_schema","EVENTS","CHARACTER_SET_CLIENT",22,"''","NO","varchar" +"119","information_schema","EVENTS","COLLATION_CONNECTION",23,"''","NO","varchar" +"120","information_schema","EVENTS","DATABASE_COLLATION",24,"''","NO","varchar" +"121","information_schema","FILES","FILE_ID",1,"0","NO","bigint" +"122","information_schema","FILES","FILE_NAME",2,"NULL","YES","varchar" +"123","information_schema","FILES","FILE_TYPE",3,"''","NO","varchar" +"124","information_schema","FILES","TABLESPACE_NAME",4,"NULL","YES","varchar" +"125","information_schema","FILES","TABLE_CATALOG",5,"''","NO","varchar" +"126","information_schema","FILES","TABLE_SCHEMA",6,"NULL","YES","varchar" +"127","information_schema","FILES","TABLE_NAME",7,"NULL","YES","varchar" +"128","information_schema","FILES","LOGFILE_GROUP_NAME",8,"NULL","YES","varchar" +"129","information_schema","FILES","LOGFILE_GROUP_NUMBER",9,"NULL","YES","bigint" +"130","information_schema","FILES","ENGINE",10,"''","NO","varchar" +"131","information_schema","FILES","FULLTEXT_KEYS",11,"NULL","YES","varchar" +"132","information_schema","FILES","DELETED_ROWS",12,"NULL","YES","bigint" +"133","information_schema","FILES","UPDATE_COUNT",13,"NULL","YES","bigint" +"134","information_schema","FILES","FREE_EXTENTS",14,"NULL","YES","bigint" +"135","information_schema","FILES","TOTAL_EXTENTS",15,"NULL","YES","bigint" +"136","information_schema","FILES","EXTENT_SIZE",16,"0","NO","bigint" +"137","information_schema","FILES","INITIAL_SIZE",17,"NULL","YES","bigint" +"138","information_schema","FILES","MAXIMUM_SIZE",18,"NULL","YES","bigint" +"139","information_schema","FILES","AUTOEXTEND_SIZE",19,"NULL","YES","bigint" +"140","information_schema","FILES","CREATION_TIME",20,"NULL","YES","datetime" +"141","information_schema","FILES","LAST_UPDATE_TIME",21,"NULL","YES","datetime" +"142","information_schema","FILES","LAST_ACCESS_TIME",22,"NULL","YES","datetime" +"143","information_schema","FILES","RECOVER_TIME",23,"NULL","YES","bigint" +"144","information_schema","FILES","TRANSACTION_COUNTER",24,"NULL","YES","bigint" +"145","information_schema","FILES","VERSION",25,"NULL","YES","bigint" +"146","information_schema","FILES","ROW_FORMAT",26,"NULL","YES","varchar" +"147","information_schema","FILES","TABLE_ROWS",27,"NULL","YES","bigint" +"148","information_schema","FILES","AVG_ROW_LENGTH",28,"NULL","YES","bigint" +"149","information_schema","FILES","DATA_LENGTH",29,"NULL","YES","bigint" +"150","information_schema","FILES","MAX_DATA_LENGTH",30,"NULL","YES","bigint" +"151","information_schema","FILES","INDEX_LENGTH",31,"NULL","YES","bigint" +"152","information_schema","FILES","DATA_FREE",32,"NULL","YES","bigint" +"153","information_schema","FILES","CREATE_TIME",33,"NULL","YES","datetime" +"154","information_schema","FILES","UPDATE_TIME",34,"NULL","YES","datetime" +"155","information_schema","FILES","CHECK_TIME",35,"NULL","YES","datetime" +"156","information_schema","FILES","CHECKSUM",36,"NULL","YES","bigint" +"157","information_schema","FILES","STATUS",37,"''","NO","varchar" +"158","information_schema","FILES","EXTRA",38,"NULL","YES","varchar" +"159","information_schema","GEOMETRY_COLUMNS","F_TABLE_CATALOG",1,"''","NO","varchar" +"160","information_schema","GEOMETRY_COLUMNS","F_TABLE_SCHEMA",2,"''","NO","varchar" +"161","information_schema","GEOMETRY_COLUMNS","F_TABLE_NAME",3,"''","NO","varchar" +"162","information_schema","GEOMETRY_COLUMNS","F_GEOMETRY_COLUMN",4,"''","NO","varchar" +"163","information_schema","GEOMETRY_COLUMNS","G_TABLE_CATALOG",5,"''","NO","varchar" +"164","information_schema","GEOMETRY_COLUMNS","G_TABLE_SCHEMA",6,"''","NO","varchar" +"165","information_schema","GEOMETRY_COLUMNS","G_TABLE_NAME",7,"''","NO","varchar" +"166","information_schema","GEOMETRY_COLUMNS","G_GEOMETRY_COLUMN",8,"''","NO","varchar" +"167","information_schema","GEOMETRY_COLUMNS","STORAGE_TYPE",9,"0","NO","tinyint" +"168","information_schema","GEOMETRY_COLUMNS","GEOMETRY_TYPE",10,"0","NO","int" +"169","information_schema","GEOMETRY_COLUMNS","COORD_DIMENSION",11,"0","NO","tinyint" +"170","information_schema","GEOMETRY_COLUMNS","MAX_PPR",12,"0","NO","tinyint" +"171","information_schema","GEOMETRY_COLUMNS","SRID",13,"0","NO","smallint" +"172","information_schema","GLOBAL_STATUS","VARIABLE_NAME",1,"''","NO","varchar" +"173","information_schema","GLOBAL_STATUS","VARIABLE_VALUE",2,"''","NO","varchar" +"174","information_schema","GLOBAL_VARIABLES","VARIABLE_NAME",1,"''","NO","varchar" +"175","information_schema","GLOBAL_VARIABLES","VARIABLE_VALUE",2,"''","NO","varchar" +"176","information_schema","INDEX_STATISTICS","TABLE_SCHEMA",1,"''","NO","varchar" +"177","information_schema","INDEX_STATISTICS","TABLE_NAME",2,"''","NO","varchar" +"178","information_schema","INDEX_STATISTICS","INDEX_NAME",3,"''","NO","varchar" +"179","information_schema","INDEX_STATISTICS","ROWS_READ",4,"0","NO","bigint" +"180","information_schema","INNODB_BUFFER_PAGE","POOL_ID",1,"0","NO","int" +"181","information_schema","INNODB_BUFFER_PAGE","BLOCK_ID",2,"0","NO","bigint" +"182","information_schema","INNODB_BUFFER_PAGE","SPACE",3,"0","NO","int" +"183","information_schema","INNODB_BUFFER_PAGE","PAGE_NUMBER",4,"0","NO","int" +"184","information_schema","INNODB_BUFFER_PAGE","PAGE_TYPE",5,"NULL","YES","varchar" +"185","information_schema","INNODB_BUFFER_PAGE","FLUSH_TYPE",6,"0","NO","int" +"186","information_schema","INNODB_BUFFER_PAGE","FIX_COUNT",7,"0","NO","int" +"187","information_schema","INNODB_BUFFER_PAGE","IS_HASHED",8,"0","NO","int" +"188","information_schema","INNODB_BUFFER_PAGE","NEWEST_MODIFICATION",9,"0","NO","bigint" +"189","information_schema","INNODB_BUFFER_PAGE","OLDEST_MODIFICATION",10,"0","NO","bigint" +"190","information_schema","INNODB_BUFFER_PAGE","ACCESS_TIME",11,"0","NO","bigint" +"191","information_schema","INNODB_BUFFER_PAGE","TABLE_NAME",12,"NULL","YES","varchar" +"192","information_schema","INNODB_BUFFER_PAGE","INDEX_NAME",13,"NULL","YES","varchar" +"193","information_schema","INNODB_BUFFER_PAGE","NUMBER_RECORDS",14,"0","NO","bigint" +"194","information_schema","INNODB_BUFFER_PAGE","DATA_SIZE",15,"0","NO","bigint" +"195","information_schema","INNODB_BUFFER_PAGE","COMPRESSED_SIZE",16,"0","NO","bigint" +"196","information_schema","INNODB_BUFFER_PAGE","PAGE_STATE",17,,"NO","enum" +"197","information_schema","INNODB_BUFFER_PAGE","IO_FIX",18,,"NO","enum" +"198","information_schema","INNODB_BUFFER_PAGE","IS_OLD",19,"0","NO","int" +"199","information_schema","INNODB_BUFFER_PAGE","FREE_PAGE_CLOCK",20,"0","NO","bigint" +"200","information_schema","INNODB_BUFFER_PAGE_LRU","POOL_ID",1,"0","NO","int" +"201","information_schema","INNODB_BUFFER_PAGE_LRU","LRU_POSITION",2,"0","NO","bigint" +"202","information_schema","INNODB_BUFFER_PAGE_LRU","SPACE",3,"0","NO","int" +"203","information_schema","INNODB_BUFFER_PAGE_LRU","PAGE_NUMBER",4,"0","NO","int" +"204","information_schema","INNODB_BUFFER_PAGE_LRU","PAGE_TYPE",5,"NULL","YES","varchar" +"205","information_schema","INNODB_BUFFER_PAGE_LRU","FLUSH_TYPE",6,"0","NO","int" +"206","information_schema","INNODB_BUFFER_PAGE_LRU","FIX_COUNT",7,"0","NO","int" +"207","information_schema","INNODB_BUFFER_PAGE_LRU","IS_HASHED",8,"0","NO","int" +"208","information_schema","INNODB_BUFFER_PAGE_LRU","NEWEST_MODIFICATION",9,"0","NO","bigint" +"209","information_schema","INNODB_BUFFER_PAGE_LRU","OLDEST_MODIFICATION",10,"0","NO","bigint" +"210","information_schema","INNODB_BUFFER_PAGE_LRU","ACCESS_TIME",11,"0","NO","bigint" +"211","information_schema","INNODB_BUFFER_PAGE_LRU","TABLE_NAME",12,"NULL","YES","varchar" +"212","information_schema","INNODB_BUFFER_PAGE_LRU","INDEX_NAME",13,"NULL","YES","varchar" +"213","information_schema","INNODB_BUFFER_PAGE_LRU","NUMBER_RECORDS",14,"0","NO","bigint" +"214","information_schema","INNODB_BUFFER_PAGE_LRU","DATA_SIZE",15,"0","NO","bigint" +"215","information_schema","INNODB_BUFFER_PAGE_LRU","COMPRESSED_SIZE",16,"0","NO","bigint" +"216","information_schema","INNODB_BUFFER_PAGE_LRU","COMPRESSED",17,"0","NO","int" +"217","information_schema","INNODB_BUFFER_PAGE_LRU","IO_FIX",18,,"NO","enum" +"218","information_schema","INNODB_BUFFER_PAGE_LRU","IS_OLD",19,"NULL","YES","int" +"219","information_schema","INNODB_BUFFER_PAGE_LRU","FREE_PAGE_CLOCK",20,"0","NO","bigint" +"220","information_schema","INNODB_BUFFER_POOL_STATS","POOL_ID",1,"0","NO","int" +"221","information_schema","INNODB_BUFFER_POOL_STATS","POOL_SIZE",2,"0","NO","bigint" +"222","information_schema","INNODB_BUFFER_POOL_STATS","FREE_BUFFERS",3,"0","NO","bigint" +"223","information_schema","INNODB_BUFFER_POOL_STATS","DATABASE_PAGES",4,"0","NO","bigint" +"224","information_schema","INNODB_BUFFER_POOL_STATS","OLD_DATABASE_PAGES",5,"0","NO","bigint" +"225","information_schema","INNODB_BUFFER_POOL_STATS","MODIFIED_DATABASE_PAGES",6,"0","NO","bigint" +"226","information_schema","INNODB_BUFFER_POOL_STATS","PENDING_DECOMPRESS",7,"0","NO","bigint" +"227","information_schema","INNODB_BUFFER_POOL_STATS","PENDING_READS",8,"0","NO","bigint" +"228","information_schema","INNODB_BUFFER_POOL_STATS","PENDING_FLUSH_LRU",9,"0","NO","bigint" +"229","information_schema","INNODB_BUFFER_POOL_STATS","PENDING_FLUSH_LIST",10,"0","NO","bigint" +"230","information_schema","INNODB_BUFFER_POOL_STATS","PAGES_MADE_YOUNG",11,"0","NO","bigint" +"231","information_schema","INNODB_BUFFER_POOL_STATS","PAGES_NOT_MADE_YOUNG",12,"0","NO","bigint" +"232","information_schema","INNODB_BUFFER_POOL_STATS","PAGES_MADE_YOUNG_RATE",13,"0","NO","float" +"233","information_schema","INNODB_BUFFER_POOL_STATS","PAGES_MADE_NOT_YOUNG_RATE",14,"0","NO","float" +"234","information_schema","INNODB_BUFFER_POOL_STATS","NUMBER_PAGES_READ",15,"0","NO","bigint" +"235","information_schema","INNODB_BUFFER_POOL_STATS","NUMBER_PAGES_CREATED",16,"0","NO","bigint" +"236","information_schema","INNODB_BUFFER_POOL_STATS","NUMBER_PAGES_WRITTEN",17,"0","NO","bigint" +"237","information_schema","INNODB_BUFFER_POOL_STATS","PAGES_READ_RATE",18,"0","NO","float" +"238","information_schema","INNODB_BUFFER_POOL_STATS","PAGES_CREATE_RATE",19,"0","NO","float" +"239","information_schema","INNODB_BUFFER_POOL_STATS","PAGES_WRITTEN_RATE",20,"0","NO","float" +"240","information_schema","INNODB_BUFFER_POOL_STATS","NUMBER_PAGES_GET",21,"0","NO","bigint" +"241","information_schema","INNODB_BUFFER_POOL_STATS","HIT_RATE",22,"0","NO","bigint" +"242","information_schema","INNODB_BUFFER_POOL_STATS","YOUNG_MAKE_PER_THOUSAND_GETS",23,"0","NO","bigint" +"243","information_schema","INNODB_BUFFER_POOL_STATS","NOT_YOUNG_MAKE_PER_THOUSAND_GETS",24,"0","NO","bigint" +"244","information_schema","INNODB_BUFFER_POOL_STATS","NUMBER_PAGES_READ_AHEAD",25,"0","NO","bigint" +"245","information_schema","INNODB_BUFFER_POOL_STATS","NUMBER_READ_AHEAD_EVICTED",26,"0","NO","bigint" +"246","information_schema","INNODB_BUFFER_POOL_STATS","READ_AHEAD_RATE",27,"0","NO","float" +"247","information_schema","INNODB_BUFFER_POOL_STATS","READ_AHEAD_EVICTED_RATE",28,"0","NO","float" +"248","information_schema","INNODB_BUFFER_POOL_STATS","LRU_IO_TOTAL",29,"0","NO","bigint" +"249","information_schema","INNODB_BUFFER_POOL_STATS","LRU_IO_CURRENT",30,"0","NO","bigint" +"250","information_schema","INNODB_BUFFER_POOL_STATS","UNCOMPRESS_TOTAL",31,"0","NO","bigint" +"251","information_schema","INNODB_BUFFER_POOL_STATS","UNCOMPRESS_CURRENT",32,"0","NO","bigint" +"252","information_schema","INNODB_CMP","page_size",1,"0","NO","int" +"253","information_schema","INNODB_CMP","compress_ops",2,"0","NO","int" +"254","information_schema","INNODB_CMP","compress_ops_ok",3,"0","NO","int" +"255","information_schema","INNODB_CMP","compress_time",4,"0","NO","int" +"256","information_schema","INNODB_CMP","uncompress_ops",5,"0","NO","int" +"257","information_schema","INNODB_CMP","uncompress_time",6,"0","NO","int" +"258","information_schema","INNODB_CMPMEM","page_size",1,"0","NO","int" +"259","information_schema","INNODB_CMPMEM","buffer_pool_instance",2,"0","NO","int" +"260","information_schema","INNODB_CMPMEM","pages_used",3,"0","NO","int" +"261","information_schema","INNODB_CMPMEM","pages_free",4,"0","NO","int" +"262","information_schema","INNODB_CMPMEM","relocation_ops",5,"0","NO","bigint" +"263","information_schema","INNODB_CMPMEM","relocation_time",6,"0","NO","int" +"264","information_schema","INNODB_CMPMEM_RESET","page_size",1,"0","NO","int" +"265","information_schema","INNODB_CMPMEM_RESET","buffer_pool_instance",2,"0","NO","int" +"266","information_schema","INNODB_CMPMEM_RESET","pages_used",3,"0","NO","int" +"267","information_schema","INNODB_CMPMEM_RESET","pages_free",4,"0","NO","int" +"268","information_schema","INNODB_CMPMEM_RESET","relocation_ops",5,"0","NO","bigint" +"269","information_schema","INNODB_CMPMEM_RESET","relocation_time",6,"0","NO","int" +"270","information_schema","INNODB_CMP_PER_INDEX","database_name",1,"''","NO","varchar" +"271","information_schema","INNODB_CMP_PER_INDEX","table_name",2,"''","NO","varchar" +"272","information_schema","INNODB_CMP_PER_INDEX","index_name",3,"''","NO","varchar" +"273","information_schema","INNODB_CMP_PER_INDEX","compress_ops",4,"0","NO","int" +"274","information_schema","INNODB_CMP_PER_INDEX","compress_ops_ok",5,"0","NO","int" +"275","information_schema","INNODB_CMP_PER_INDEX","compress_time",6,"0","NO","int" +"276","information_schema","INNODB_CMP_PER_INDEX","uncompress_ops",7,"0","NO","int" +"277","information_schema","INNODB_CMP_PER_INDEX","uncompress_time",8,"0","NO","int" +"278","information_schema","INNODB_CMP_PER_INDEX_RESET","database_name",1,"''","NO","varchar" +"279","information_schema","INNODB_CMP_PER_INDEX_RESET","table_name",2,"''","NO","varchar" +"280","information_schema","INNODB_CMP_PER_INDEX_RESET","index_name",3,"''","NO","varchar" +"281","information_schema","INNODB_CMP_PER_INDEX_RESET","compress_ops",4,"0","NO","int" +"282","information_schema","INNODB_CMP_PER_INDEX_RESET","compress_ops_ok",5,"0","NO","int" +"283","information_schema","INNODB_CMP_PER_INDEX_RESET","compress_time",6,"0","NO","int" +"284","information_schema","INNODB_CMP_PER_INDEX_RESET","uncompress_ops",7,"0","NO","int" +"285","information_schema","INNODB_CMP_PER_INDEX_RESET","uncompress_time",8,"0","NO","int" +"286","information_schema","INNODB_CMP_RESET","page_size",1,"0","NO","int" +"287","information_schema","INNODB_CMP_RESET","compress_ops",2,"0","NO","int" +"288","information_schema","INNODB_CMP_RESET","compress_ops_ok",3,"0","NO","int" +"289","information_schema","INNODB_CMP_RESET","compress_time",4,"0","NO","int" +"290","information_schema","INNODB_CMP_RESET","uncompress_ops",5,"0","NO","int" +"291","information_schema","INNODB_CMP_RESET","uncompress_time",6,"0","NO","int" +"292","information_schema","INNODB_FT_BEING_DELETED","DOC_ID",1,"0","NO","bigint" +"293","information_schema","INNODB_FT_CONFIG","KEY",1,"''","NO","varchar" +"294","information_schema","INNODB_FT_CONFIG","VALUE",2,"''","NO","varchar" +"295","information_schema","INNODB_FT_DEFAULT_STOPWORD","value",1,"''","NO","varchar" +"296","information_schema","INNODB_FT_DELETED","DOC_ID",1,"0","NO","bigint" +"297","information_schema","INNODB_FT_INDEX_CACHE","WORD",1,"''","NO","varchar" +"298","information_schema","INNODB_FT_INDEX_CACHE","FIRST_DOC_ID",2,"0","NO","bigint" +"299","information_schema","INNODB_FT_INDEX_CACHE","LAST_DOC_ID",3,"0","NO","bigint" +"300","information_schema","INNODB_FT_INDEX_CACHE","DOC_COUNT",4,"0","NO","bigint" +"301","information_schema","INNODB_FT_INDEX_CACHE","DOC_ID",5,"0","NO","bigint" +"302","information_schema","INNODB_FT_INDEX_CACHE","POSITION",6,"0","NO","bigint" +"303","information_schema","INNODB_FT_INDEX_TABLE","WORD",1,"''","NO","varchar" +"304","information_schema","INNODB_FT_INDEX_TABLE","FIRST_DOC_ID",2,"0","NO","bigint" +"305","information_schema","INNODB_FT_INDEX_TABLE","LAST_DOC_ID",3,"0","NO","bigint" +"306","information_schema","INNODB_FT_INDEX_TABLE","DOC_COUNT",4,"0","NO","bigint" +"307","information_schema","INNODB_FT_INDEX_TABLE","DOC_ID",5,"0","NO","bigint" +"308","information_schema","INNODB_FT_INDEX_TABLE","POSITION",6,"0","NO","bigint" +"309","information_schema","INNODB_LOCKS","lock_id",1,"''","NO","varchar" +"310","information_schema","INNODB_LOCKS","lock_trx_id",2,"0","NO","bigint" +"311","information_schema","INNODB_LOCKS","lock_mode",3,,"NO","enum" +"312","information_schema","INNODB_LOCKS","lock_type",4,,"NO","enum" +"313","information_schema","INNODB_LOCKS","lock_table",5,"''","NO","varchar" +"314","information_schema","INNODB_LOCKS","lock_index",6,"NULL","YES","varchar" +"315","information_schema","INNODB_LOCKS","lock_space",7,"NULL","YES","int" +"316","information_schema","INNODB_LOCKS","lock_page",8,"NULL","YES","int" +"317","information_schema","INNODB_LOCKS","lock_rec",9,"NULL","YES","int" +"318","information_schema","INNODB_LOCKS","lock_data",10,"NULL","YES","varchar" +"319","information_schema","INNODB_LOCK_WAITS","requesting_trx_id",1,"0","NO","bigint" +"320","information_schema","INNODB_LOCK_WAITS","requested_lock_id",2,"''","NO","varchar" +"321","information_schema","INNODB_LOCK_WAITS","blocking_trx_id",3,"0","NO","bigint" +"322","information_schema","INNODB_LOCK_WAITS","blocking_lock_id",4,"''","NO","varchar" +"323","information_schema","INNODB_METRICS","NAME",1,"''","NO","varchar" +"324","information_schema","INNODB_METRICS","SUBSYSTEM",2,"''","NO","varchar" +"325","information_schema","INNODB_METRICS","COUNT",3,"0","NO","bigint" +"326","information_schema","INNODB_METRICS","MAX_COUNT",4,"NULL","YES","bigint" +"327","information_schema","INNODB_METRICS","MIN_COUNT",5,"NULL","YES","bigint" +"328","information_schema","INNODB_METRICS","AVG_COUNT",6,"NULL","YES","float" +"329","information_schema","INNODB_METRICS","COUNT_RESET",7,"0","NO","bigint" +"330","information_schema","INNODB_METRICS","MAX_COUNT_RESET",8,"NULL","YES","bigint" +"331","information_schema","INNODB_METRICS","MIN_COUNT_RESET",9,"NULL","YES","bigint" +"332","information_schema","INNODB_METRICS","AVG_COUNT_RESET",10,"NULL","YES","float" +"333","information_schema","INNODB_METRICS","TIME_ENABLED",11,"NULL","YES","datetime" +"334","information_schema","INNODB_METRICS","TIME_DISABLED",12,"NULL","YES","datetime" +"335","information_schema","INNODB_METRICS","TIME_ELAPSED",13,"NULL","YES","bigint" +"336","information_schema","INNODB_METRICS","TIME_RESET",14,"NULL","YES","datetime" +"337","information_schema","INNODB_METRICS","ENABLED",15,"0","NO","int" +"338","information_schema","INNODB_METRICS","TYPE",16,,"NO","enum" +"339","information_schema","INNODB_METRICS","COMMENT",17,"''","NO","varchar" +"340","information_schema","INNODB_SYS_COLUMNS","TABLE_ID",1,"0","NO","bigint" +"341","information_schema","INNODB_SYS_COLUMNS","NAME",2,"''","NO","varchar" +"342","information_schema","INNODB_SYS_COLUMNS","POS",3,"0","NO","bigint" +"343","information_schema","INNODB_SYS_COLUMNS","MTYPE",4,"0","NO","int" +"344","information_schema","INNODB_SYS_COLUMNS","PRTYPE",5,"0","NO","int" +"345","information_schema","INNODB_SYS_COLUMNS","LEN",6,"0","NO","int" +"346","information_schema","INNODB_SYS_FIELDS","INDEX_ID",1,"0","NO","bigint" +"347","information_schema","INNODB_SYS_FIELDS","NAME",2,"''","NO","varchar" +"348","information_schema","INNODB_SYS_FIELDS","POS",3,"0","NO","int" +"349","information_schema","INNODB_SYS_FOREIGN","ID",1,"''","NO","varchar" +"350","information_schema","INNODB_SYS_FOREIGN","FOR_NAME",2,"''","NO","varchar" +"351","information_schema","INNODB_SYS_FOREIGN","REF_NAME",3,"''","NO","varchar" +"352","information_schema","INNODB_SYS_FOREIGN","N_COLS",4,"0","NO","int" +"353","information_schema","INNODB_SYS_FOREIGN","TYPE",5,"0","NO","int" +"354","information_schema","INNODB_SYS_FOREIGN_COLS","ID",1,"''","NO","varchar" +"355","information_schema","INNODB_SYS_FOREIGN_COLS","FOR_COL_NAME",2,"''","NO","varchar" +"356","information_schema","INNODB_SYS_FOREIGN_COLS","REF_COL_NAME",3,"''","NO","varchar" +"357","information_schema","INNODB_SYS_FOREIGN_COLS","POS",4,"0","NO","int" +"358","information_schema","INNODB_SYS_INDEXES","INDEX_ID",1,"0","NO","bigint" +"359","information_schema","INNODB_SYS_INDEXES","NAME",2,"''","NO","varchar" +"360","information_schema","INNODB_SYS_INDEXES","TABLE_ID",3,"0","NO","bigint" +"361","information_schema","INNODB_SYS_INDEXES","TYPE",4,"0","NO","int" +"362","information_schema","INNODB_SYS_INDEXES","N_FIELDS",5,"0","NO","int" +"363","information_schema","INNODB_SYS_INDEXES","PAGE_NO",6,"0","NO","int" +"364","information_schema","INNODB_SYS_INDEXES","SPACE",7,"0","NO","int" +"365","information_schema","INNODB_SYS_INDEXES","MERGE_THRESHOLD",8,"0","NO","int" +"366","information_schema","INNODB_SYS_TABLES","TABLE_ID",1,"0","NO","bigint" +"367","information_schema","INNODB_SYS_TABLES","NAME",2,"''","NO","varchar" +"368","information_schema","INNODB_SYS_TABLES","FLAG",3,"0","NO","int" +"369","information_schema","INNODB_SYS_TABLES","N_COLS",4,"0","NO","int" +"370","information_schema","INNODB_SYS_TABLES","SPACE",5,"0","NO","int" +"371","information_schema","INNODB_SYS_TABLES","ROW_FORMAT",6,"NULL","YES","enum" +"372","information_schema","INNODB_SYS_TABLES","ZIP_PAGE_SIZE",7,"0","NO","int" +"373","information_schema","INNODB_SYS_TABLES","SPACE_TYPE",8,"NULL","YES","enum" +"374","information_schema","INNODB_SYS_TABLESPACES","SPACE",1,"0","NO","int" +"375","information_schema","INNODB_SYS_TABLESPACES","NAME",2,"''","NO","varchar" +"376","information_schema","INNODB_SYS_TABLESPACES","FLAG",3,"0","NO","int" +"377","information_schema","INNODB_SYS_TABLESPACES","ROW_FORMAT",4,"NULL","YES","varchar" +"378","information_schema","INNODB_SYS_TABLESPACES","PAGE_SIZE",5,"0","NO","int" +"379","information_schema","INNODB_SYS_TABLESPACES","FILENAME",6,"''","NO","varchar" +"380","information_schema","INNODB_SYS_TABLESPACES","FS_BLOCK_SIZE",7,"0","NO","int" +"381","information_schema","INNODB_SYS_TABLESPACES","FILE_SIZE",8,"0","NO","bigint" +"382","information_schema","INNODB_SYS_TABLESPACES","ALLOCATED_SIZE",9,"0","NO","bigint" +"383","information_schema","INNODB_SYS_TABLESTATS","TABLE_ID",1,"0","NO","bigint" +"384","information_schema","INNODB_SYS_TABLESTATS","NAME",2,"''","NO","varchar" +"385","information_schema","INNODB_SYS_TABLESTATS","STATS_INITIALIZED",3,"0","NO","int" +"386","information_schema","INNODB_SYS_TABLESTATS","NUM_ROWS",4,"0","NO","bigint" +"387","information_schema","INNODB_SYS_TABLESTATS","CLUST_INDEX_SIZE",5,"0","NO","bigint" +"388","information_schema","INNODB_SYS_TABLESTATS","OTHER_INDEX_SIZE",6,"0","NO","bigint" +"389","information_schema","INNODB_SYS_TABLESTATS","MODIFIED_COUNTER",7,"0","NO","bigint" +"390","information_schema","INNODB_SYS_TABLESTATS","AUTOINC",8,"0","NO","bigint" +"391","information_schema","INNODB_SYS_TABLESTATS","REF_COUNT",9,"0","NO","int" +"392","information_schema","INNODB_SYS_VIRTUAL","TABLE_ID",1,"0","NO","bigint" +"393","information_schema","INNODB_SYS_VIRTUAL","POS",2,"0","NO","int" +"394","information_schema","INNODB_SYS_VIRTUAL","BASE_POS",3,"0","NO","int" +"395","information_schema","INNODB_TABLESPACES_ENCRYPTION","SPACE",1,"0","NO","int" +"396","information_schema","INNODB_TABLESPACES_ENCRYPTION","NAME",2,"NULL","YES","varchar" +"397","information_schema","INNODB_TABLESPACES_ENCRYPTION","ENCRYPTION_SCHEME",3,"0","NO","int" +"398","information_schema","INNODB_TABLESPACES_ENCRYPTION","KEYSERVER_REQUESTS",4,"0","NO","int" +"399","information_schema","INNODB_TABLESPACES_ENCRYPTION","MIN_KEY_VERSION",5,"0","NO","int" +"400","information_schema","INNODB_TABLESPACES_ENCRYPTION","CURRENT_KEY_VERSION",6,"0","NO","int" +"401","information_schema","INNODB_TABLESPACES_ENCRYPTION","KEY_ROTATION_PAGE_NUMBER",7,"NULL","YES","bigint" +"402","information_schema","INNODB_TABLESPACES_ENCRYPTION","KEY_ROTATION_MAX_PAGE_NUMBER",8,"NULL","YES","bigint" +"403","information_schema","INNODB_TABLESPACES_ENCRYPTION","CURRENT_KEY_ID",9,"0","NO","int" +"404","information_schema","INNODB_TABLESPACES_ENCRYPTION","ROTATING_OR_FLUSHING",10,"0","NO","int" +"405","information_schema","INNODB_TRX","trx_id",1,"0","NO","bigint" +"406","information_schema","INNODB_TRX","trx_state",2,"''","NO","varchar" +"407","information_schema","INNODB_TRX","trx_started",3,"'0000-00-00 00:00:00'","NO","datetime" +"408","information_schema","INNODB_TRX","trx_requested_lock_id",4,"NULL","YES","varchar" +"409","information_schema","INNODB_TRX","trx_wait_started",5,"NULL","YES","datetime" +"410","information_schema","INNODB_TRX","trx_weight",6,"0","NO","bigint" +"411","information_schema","INNODB_TRX","trx_mysql_thread_id",7,"0","NO","bigint" +"412","information_schema","INNODB_TRX","trx_query",8,"NULL","YES","varchar" +"413","information_schema","INNODB_TRX","trx_operation_state",9,"NULL","YES","varchar" +"414","information_schema","INNODB_TRX","trx_tables_in_use",10,"0","NO","bigint" +"415","information_schema","INNODB_TRX","trx_tables_locked",11,"0","NO","bigint" +"416","information_schema","INNODB_TRX","trx_lock_structs",12,"0","NO","bigint" +"417","information_schema","INNODB_TRX","trx_lock_memory_bytes",13,"0","NO","bigint" +"418","information_schema","INNODB_TRX","trx_rows_locked",14,"0","NO","bigint" +"419","information_schema","INNODB_TRX","trx_rows_modified",15,"0","NO","bigint" +"420","information_schema","INNODB_TRX","trx_concurrency_tickets",16,"0","NO","bigint" +"421","information_schema","INNODB_TRX","trx_isolation_level",17,,"NO","enum" +"422","information_schema","INNODB_TRX","trx_unique_checks",18,"0","NO","int" +"423","information_schema","INNODB_TRX","trx_foreign_key_checks",19,"0","NO","int" +"424","information_schema","INNODB_TRX","trx_last_foreign_key_error",20,"NULL","YES","varchar" +"425","information_schema","INNODB_TRX","trx_is_read_only",21,"0","NO","int" +"426","information_schema","INNODB_TRX","trx_autocommit_non_locking",22,"0","NO","int" +"427","information_schema","KEYWORDS","WORD",1,"NULL","YES","varchar" +"428","information_schema","KEY_CACHES","KEY_CACHE_NAME",1,"''","NO","varchar" +"429","information_schema","KEY_CACHES","SEGMENTS",2,"NULL","YES","int" +"430","information_schema","KEY_CACHES","SEGMENT_NUMBER",3,"NULL","YES","int" +"431","information_schema","KEY_CACHES","FULL_SIZE",4,"0","NO","bigint" +"432","information_schema","KEY_CACHES","BLOCK_SIZE",5,"0","NO","bigint" +"433","information_schema","KEY_CACHES","USED_BLOCKS",6,"0","NO","bigint" +"434","information_schema","KEY_CACHES","UNUSED_BLOCKS",7,"0","NO","bigint" +"435","information_schema","KEY_CACHES","DIRTY_BLOCKS",8,"0","NO","bigint" +"436","information_schema","KEY_CACHES","READ_REQUESTS",9,"0","NO","bigint" +"437","information_schema","KEY_CACHES","READS",10,"0","NO","bigint" +"438","information_schema","KEY_CACHES","WRITE_REQUESTS",11,"0","NO","bigint" +"439","information_schema","KEY_CACHES","WRITES",12,"0","NO","bigint" +"440","information_schema","KEY_COLUMN_USAGE","CONSTRAINT_CATALOG",1,"''","NO","varchar" +"441","information_schema","KEY_COLUMN_USAGE","CONSTRAINT_SCHEMA",2,"''","NO","varchar" +"442","information_schema","KEY_COLUMN_USAGE","CONSTRAINT_NAME",3,"''","NO","varchar" +"443","information_schema","KEY_COLUMN_USAGE","TABLE_CATALOG",4,"''","NO","varchar" +"444","information_schema","KEY_COLUMN_USAGE","TABLE_SCHEMA",5,"''","NO","varchar" +"445","information_schema","KEY_COLUMN_USAGE","TABLE_NAME",6,"''","NO","varchar" +"446","information_schema","KEY_COLUMN_USAGE","COLUMN_NAME",7,"''","NO","varchar" +"447","information_schema","KEY_COLUMN_USAGE","ORDINAL_POSITION",8,"0","NO","bigint" +"448","information_schema","KEY_COLUMN_USAGE","POSITION_IN_UNIQUE_CONSTRAINT",9,"NULL","YES","bigint" +"449","information_schema","KEY_COLUMN_USAGE","REFERENCED_TABLE_SCHEMA",10,"NULL","YES","varchar" +"450","information_schema","KEY_COLUMN_USAGE","REFERENCED_TABLE_NAME",11,"NULL","YES","varchar" +"451","information_schema","KEY_COLUMN_USAGE","REFERENCED_COLUMN_NAME",12,"NULL","YES","varchar" +"452","information_schema","OPTIMIZER_TRACE","QUERY",1,"''","NO","longtext" +"453","information_schema","OPTIMIZER_TRACE","TRACE",2,"''","NO","longtext" +"454","information_schema","OPTIMIZER_TRACE","MISSING_BYTES_BEYOND_MAX_MEM_SIZE",3,"0","NO","int" +"455","information_schema","OPTIMIZER_TRACE","INSUFFICIENT_PRIVILEGES",4,"0","NO","tinyint" +"456","information_schema","PARAMETERS","SPECIFIC_CATALOG",1,"''","NO","varchar" +"457","information_schema","PARAMETERS","SPECIFIC_SCHEMA",2,"''","NO","varchar" +"458","information_schema","PARAMETERS","SPECIFIC_NAME",3,"''","NO","varchar" +"459","information_schema","PARAMETERS","ORDINAL_POSITION",4,"0","NO","int" +"460","information_schema","PARAMETERS","PARAMETER_MODE",5,"NULL","YES","varchar" +"461","information_schema","PARAMETERS","PARAMETER_NAME",6,"NULL","YES","varchar" +"462","information_schema","PARAMETERS","DATA_TYPE",7,"''","NO","varchar" +"463","information_schema","PARAMETERS","CHARACTER_MAXIMUM_LENGTH",8,"NULL","YES","int" +"464","information_schema","PARAMETERS","CHARACTER_OCTET_LENGTH",9,"NULL","YES","int" +"465","information_schema","PARAMETERS","NUMERIC_PRECISION",10,"NULL","YES","int" +"466","information_schema","PARAMETERS","NUMERIC_SCALE",11,"NULL","YES","int" +"467","information_schema","PARAMETERS","DATETIME_PRECISION",12,"NULL","YES","bigint" +"468","information_schema","PARAMETERS","CHARACTER_SET_NAME",13,"NULL","YES","varchar" +"469","information_schema","PARAMETERS","COLLATION_NAME",14,"NULL","YES","varchar" +"470","information_schema","PARAMETERS","DTD_IDENTIFIER",15,"''","NO","longtext" +"471","information_schema","PARAMETERS","ROUTINE_TYPE",16,"''","NO","varchar" +"472","information_schema","PARTITIONS","TABLE_CATALOG",1,"''","NO","varchar" +"473","information_schema","PARTITIONS","TABLE_SCHEMA",2,"''","NO","varchar" +"474","information_schema","PARTITIONS","TABLE_NAME",3,"''","NO","varchar" +"475","information_schema","PARTITIONS","PARTITION_NAME",4,"NULL","YES","varchar" +"476","information_schema","PARTITIONS","SUBPARTITION_NAME",5,"NULL","YES","varchar" +"477","information_schema","PARTITIONS","PARTITION_ORDINAL_POSITION",6,"NULL","YES","bigint" +"478","information_schema","PARTITIONS","SUBPARTITION_ORDINAL_POSITION",7,"NULL","YES","bigint" +"479","information_schema","PARTITIONS","PARTITION_METHOD",8,"NULL","YES","varchar" +"480","information_schema","PARTITIONS","SUBPARTITION_METHOD",9,"NULL","YES","varchar" +"481","information_schema","PARTITIONS","PARTITION_EXPRESSION",10,"NULL","YES","longtext" +"482","information_schema","PARTITIONS","SUBPARTITION_EXPRESSION",11,"NULL","YES","longtext" +"483","information_schema","PARTITIONS","PARTITION_DESCRIPTION",12,"NULL","YES","longtext" +"484","information_schema","PARTITIONS","TABLE_ROWS",13,"0","NO","bigint" +"485","information_schema","PARTITIONS","AVG_ROW_LENGTH",14,"0","NO","bigint" +"486","information_schema","PARTITIONS","DATA_LENGTH",15,"0","NO","bigint" +"487","information_schema","PARTITIONS","MAX_DATA_LENGTH",16,"NULL","YES","bigint" +"488","information_schema","PARTITIONS","INDEX_LENGTH",17,"0","NO","bigint" +"489","information_schema","PARTITIONS","DATA_FREE",18,"0","NO","bigint" +"490","information_schema","PARTITIONS","CREATE_TIME",19,"NULL","YES","datetime" +"491","information_schema","PARTITIONS","UPDATE_TIME",20,"NULL","YES","datetime" +"492","information_schema","PARTITIONS","CHECK_TIME",21,"NULL","YES","datetime" +"493","information_schema","PARTITIONS","CHECKSUM",22,"NULL","YES","bigint" +"494","information_schema","PARTITIONS","PARTITION_COMMENT",23,"''","NO","varchar" +"495","information_schema","PARTITIONS","NODEGROUP",24,"''","NO","varchar" +"496","information_schema","PARTITIONS","TABLESPACE_NAME",25,"NULL","YES","varchar" +"497","information_schema","PLUGINS","PLUGIN_NAME",1,"''","NO","varchar" +"498","information_schema","PLUGINS","PLUGIN_VERSION",2,"''","NO","varchar" +"499","information_schema","PLUGINS","PLUGIN_STATUS",3,"''","NO","varchar" +"500","information_schema","PLUGINS","PLUGIN_TYPE",4,"''","NO","varchar" +"501","information_schema","PLUGINS","PLUGIN_TYPE_VERSION",5,"''","NO","varchar" +"502","information_schema","PLUGINS","PLUGIN_LIBRARY",6,"NULL","YES","varchar" +"503","information_schema","PLUGINS","PLUGIN_LIBRARY_VERSION",7,"NULL","YES","varchar" +"504","information_schema","PLUGINS","PLUGIN_AUTHOR",8,"NULL","YES","varchar" +"505","information_schema","PLUGINS","PLUGIN_DESCRIPTION",9,"NULL","YES","longtext" +"506","information_schema","PLUGINS","PLUGIN_LICENSE",10,"''","NO","varchar" +"507","information_schema","PLUGINS","LOAD_OPTION",11,"''","NO","varchar" +"508","information_schema","PLUGINS","PLUGIN_MATURITY",12,"''","NO","varchar" +"509","information_schema","PLUGINS","PLUGIN_AUTH_VERSION",13,"NULL","YES","varchar" +"510","information_schema","PROCESSLIST","ID",1,"0","NO","bigint" +"511","information_schema","PROCESSLIST","USER",2,"''","NO","varchar" +"512","information_schema","PROCESSLIST","HOST",3,"''","NO","varchar" +"513","information_schema","PROCESSLIST","DB",4,"NULL","YES","varchar" +"514","information_schema","PROCESSLIST","COMMAND",5,"''","NO","varchar" +"515","information_schema","PROCESSLIST","TIME",6,"0","NO","int" +"516","information_schema","PROCESSLIST","STATE",7,"NULL","YES","varchar" +"517","information_schema","PROCESSLIST","INFO",8,"NULL","YES","longtext" +"518","information_schema","PROCESSLIST","TIME_MS",9,"0.000","NO","decimal" +"519","information_schema","PROCESSLIST","STAGE",10,"0","NO","tinyint" +"520","information_schema","PROCESSLIST","MAX_STAGE",11,"0","NO","tinyint" +"521","information_schema","PROCESSLIST","PROGRESS",12,"0.000","NO","decimal" +"522","information_schema","PROCESSLIST","MEMORY_USED",13,"0","NO","bigint" +"523","information_schema","PROCESSLIST","MAX_MEMORY_USED",14,"0","NO","bigint" +"524","information_schema","PROCESSLIST","EXAMINED_ROWS",15,"0","NO","int" +"525","information_schema","PROCESSLIST","QUERY_ID",16,"0","NO","bigint" +"526","information_schema","PROCESSLIST","INFO_BINARY",17,"NULL","YES","blob" +"527","information_schema","PROCESSLIST","TID",18,"0","NO","bigint" +"528","information_schema","PROFILING","QUERY_ID",1,"0","NO","int" +"529","information_schema","PROFILING","SEQ",2,"0","NO","int" +"530","information_schema","PROFILING","STATE",3,"''","NO","varchar" +"531","information_schema","PROFILING","DURATION",4,"0.000000","NO","decimal" +"532","information_schema","PROFILING","CPU_USER",5,"NULL","YES","decimal" +"533","information_schema","PROFILING","CPU_SYSTEM",6,"NULL","YES","decimal" +"534","information_schema","PROFILING","CONTEXT_VOLUNTARY",7,"NULL","YES","int" +"535","information_schema","PROFILING","CONTEXT_INVOLUNTARY",8,"NULL","YES","int" +"536","information_schema","PROFILING","BLOCK_OPS_IN",9,"NULL","YES","int" +"537","information_schema","PROFILING","BLOCK_OPS_OUT",10,"NULL","YES","int" +"538","information_schema","PROFILING","MESSAGES_SENT",11,"NULL","YES","int" +"539","information_schema","PROFILING","MESSAGES_RECEIVED",12,"NULL","YES","int" +"540","information_schema","PROFILING","PAGE_FAULTS_MAJOR",13,"NULL","YES","int" +"541","information_schema","PROFILING","PAGE_FAULTS_MINOR",14,"NULL","YES","int" +"542","information_schema","PROFILING","SWAPS",15,"NULL","YES","int" +"543","information_schema","PROFILING","SOURCE_FUNCTION",16,"NULL","YES","varchar" +"544","information_schema","PROFILING","SOURCE_FILE",17,"NULL","YES","varchar" +"545","information_schema","PROFILING","SOURCE_LINE",18,"NULL","YES","int" +"546","information_schema","REFERENTIAL_CONSTRAINTS","CONSTRAINT_CATALOG",1,"''","NO","varchar" +"547","information_schema","REFERENTIAL_CONSTRAINTS","CONSTRAINT_SCHEMA",2,"''","NO","varchar" +"548","information_schema","REFERENTIAL_CONSTRAINTS","CONSTRAINT_NAME",3,"''","NO","varchar" +"549","information_schema","REFERENTIAL_CONSTRAINTS","UNIQUE_CONSTRAINT_CATALOG",4,"''","NO","varchar" +"550","information_schema","REFERENTIAL_CONSTRAINTS","UNIQUE_CONSTRAINT_SCHEMA",5,"''","NO","varchar" +"551","information_schema","REFERENTIAL_CONSTRAINTS","UNIQUE_CONSTRAINT_NAME",6,"NULL","YES","varchar" +"552","information_schema","REFERENTIAL_CONSTRAINTS","MATCH_OPTION",7,"''","NO","varchar" +"553","information_schema","REFERENTIAL_CONSTRAINTS","UPDATE_RULE",8,"''","NO","varchar" +"554","information_schema","REFERENTIAL_CONSTRAINTS","DELETE_RULE",9,"''","NO","varchar" +"555","information_schema","REFERENTIAL_CONSTRAINTS","TABLE_NAME",10,"''","NO","varchar" +"556","information_schema","REFERENTIAL_CONSTRAINTS","REFERENCED_TABLE_NAME",11,"''","NO","varchar" +"557","information_schema","ROUTINES","SPECIFIC_NAME",1,"''","NO","varchar" +"558","information_schema","ROUTINES","ROUTINE_CATALOG",2,"''","NO","varchar" +"559","information_schema","ROUTINES","ROUTINE_SCHEMA",3,"''","NO","varchar" +"560","information_schema","ROUTINES","ROUTINE_NAME",4,"''","NO","varchar" +"561","information_schema","ROUTINES","ROUTINE_TYPE",5,"''","NO","varchar" +"562","information_schema","ROUTINES","DATA_TYPE",6,"''","NO","varchar" +"563","information_schema","ROUTINES","CHARACTER_MAXIMUM_LENGTH",7,"NULL","YES","int" +"564","information_schema","ROUTINES","CHARACTER_OCTET_LENGTH",8,"NULL","YES","int" +"565","information_schema","ROUTINES","NUMERIC_PRECISION",9,"NULL","YES","int" +"566","information_schema","ROUTINES","NUMERIC_SCALE",10,"NULL","YES","int" +"567","information_schema","ROUTINES","DATETIME_PRECISION",11,"NULL","YES","bigint" +"568","information_schema","ROUTINES","CHARACTER_SET_NAME",12,"NULL","YES","varchar" +"569","information_schema","ROUTINES","COLLATION_NAME",13,"NULL","YES","varchar" +"570","information_schema","ROUTINES","DTD_IDENTIFIER",14,"NULL","YES","longtext" +"571","information_schema","ROUTINES","ROUTINE_BODY",15,"''","NO","varchar" +"572","information_schema","ROUTINES","ROUTINE_DEFINITION",16,"NULL","YES","longtext" +"573","information_schema","ROUTINES","EXTERNAL_NAME",17,"NULL","YES","varchar" +"574","information_schema","ROUTINES","EXTERNAL_LANGUAGE",18,"NULL","YES","varchar" +"575","information_schema","ROUTINES","PARAMETER_STYLE",19,"''","NO","varchar" +"576","information_schema","ROUTINES","IS_DETERMINISTIC",20,"''","NO","varchar" +"577","information_schema","ROUTINES","SQL_DATA_ACCESS",21,"''","NO","varchar" +"578","information_schema","ROUTINES","SQL_PATH",22,"NULL","YES","varchar" +"579","information_schema","ROUTINES","SECURITY_TYPE",23,"''","NO","varchar" +"580","information_schema","ROUTINES","CREATED",24,"'0000-00-00 00:00:00'","NO","datetime" +"581","information_schema","ROUTINES","LAST_ALTERED",25,"'0000-00-00 00:00:00'","NO","datetime" +"582","information_schema","ROUTINES","SQL_MODE",26,"''","NO","varchar" +"583","information_schema","ROUTINES","ROUTINE_COMMENT",27,"''","NO","longtext" +"584","information_schema","ROUTINES","DEFINER",28,"''","NO","varchar" +"585","information_schema","ROUTINES","CHARACTER_SET_CLIENT",29,"''","NO","varchar" +"586","information_schema","ROUTINES","COLLATION_CONNECTION",30,"''","NO","varchar" +"587","information_schema","ROUTINES","DATABASE_COLLATION",31,"''","NO","varchar" +"588","information_schema","SCHEMATA","CATALOG_NAME",1,"''","NO","varchar" +"589","information_schema","SCHEMATA","SCHEMA_NAME",2,"''","NO","varchar" +"590","information_schema","SCHEMATA","DEFAULT_CHARACTER_SET_NAME",3,"''","NO","varchar" +"591","information_schema","SCHEMATA","DEFAULT_COLLATION_NAME",4,"''","NO","varchar" +"592","information_schema","SCHEMATA","SQL_PATH",5,"NULL","YES","varchar" +"593","information_schema","SCHEMATA","SCHEMA_COMMENT",6,"''","NO","varchar" +"594","information_schema","SCHEMA_PRIVILEGES","GRANTEE",1,"''","NO","varchar" +"595","information_schema","SCHEMA_PRIVILEGES","TABLE_CATALOG",2,"''","NO","varchar" +"596","information_schema","SCHEMA_PRIVILEGES","TABLE_SCHEMA",3,"''","NO","varchar" +"597","information_schema","SCHEMA_PRIVILEGES","PRIVILEGE_TYPE",4,"''","NO","varchar" +"598","information_schema","SCHEMA_PRIVILEGES","IS_GRANTABLE",5,"''","NO","varchar" +"599","information_schema","SESSION_STATUS","VARIABLE_NAME",1,"''","NO","varchar" +"600","information_schema","SESSION_STATUS","VARIABLE_VALUE",2,"''","NO","varchar" +"601","information_schema","SESSION_VARIABLES","VARIABLE_NAME",1,"''","NO","varchar" +"602","information_schema","SESSION_VARIABLES","VARIABLE_VALUE",2,"''","NO","varchar" +"603","information_schema","SPATIAL_REF_SYS","SRID",1,"0","NO","smallint" +"604","information_schema","SPATIAL_REF_SYS","AUTH_NAME",2,"''","NO","varchar" +"605","information_schema","SPATIAL_REF_SYS","AUTH_SRID",3,"0","NO","int" +"606","information_schema","SPATIAL_REF_SYS","SRTEXT",4,"''","NO","varchar" +"607","information_schema","SQL_FUNCTIONS","FUNCTION",1,"NULL","YES","varchar" +"608","information_schema","STATISTICS","TABLE_CATALOG",1,"''","NO","varchar" +"609","information_schema","STATISTICS","TABLE_SCHEMA",2,"''","NO","varchar" +"610","information_schema","STATISTICS","TABLE_NAME",3,"''","NO","varchar" +"611","information_schema","STATISTICS","NON_UNIQUE",4,"0","NO","bigint" +"612","information_schema","STATISTICS","INDEX_SCHEMA",5,"''","NO","varchar" +"613","information_schema","STATISTICS","INDEX_NAME",6,"''","NO","varchar" +"614","information_schema","STATISTICS","SEQ_IN_INDEX",7,"0","NO","bigint" +"615","information_schema","STATISTICS","COLUMN_NAME",8,"''","NO","varchar" +"616","information_schema","STATISTICS","COLLATION",9,"NULL","YES","varchar" +"617","information_schema","STATISTICS","CARDINALITY",10,"NULL","YES","bigint" +"618","information_schema","STATISTICS","SUB_PART",11,"NULL","YES","bigint" +"619","information_schema","STATISTICS","PACKED",12,"NULL","YES","varchar" +"620","information_schema","STATISTICS","NULLABLE",13,"''","NO","varchar" +"621","information_schema","STATISTICS","INDEX_TYPE",14,"''","NO","varchar" +"622","information_schema","STATISTICS","COMMENT",15,"NULL","YES","varchar" +"623","information_schema","STATISTICS","INDEX_COMMENT",16,"''","NO","varchar" +"624","information_schema","STATISTICS","IGNORED",17,"''","NO","varchar" +"625","information_schema","SYSTEM_VARIABLES","VARIABLE_NAME",1,"''","NO","varchar" +"626","information_schema","SYSTEM_VARIABLES","SESSION_VALUE",2,"NULL","YES","varchar" +"627","information_schema","SYSTEM_VARIABLES","GLOBAL_VALUE",3,"NULL","YES","varchar" +"628","information_schema","SYSTEM_VARIABLES","GLOBAL_VALUE_ORIGIN",4,"''","NO","varchar" +"629","information_schema","SYSTEM_VARIABLES","DEFAULT_VALUE",5,"NULL","YES","varchar" +"630","information_schema","SYSTEM_VARIABLES","VARIABLE_SCOPE",6,"''","NO","varchar" +"631","information_schema","SYSTEM_VARIABLES","VARIABLE_TYPE",7,"''","NO","varchar" +"632","information_schema","SYSTEM_VARIABLES","VARIABLE_COMMENT",8,"''","NO","varchar" +"633","information_schema","SYSTEM_VARIABLES","NUMERIC_MIN_VALUE",9,"NULL","YES","varchar" +"634","information_schema","SYSTEM_VARIABLES","NUMERIC_MAX_VALUE",10,"NULL","YES","varchar" +"635","information_schema","SYSTEM_VARIABLES","NUMERIC_BLOCK_SIZE",11,"NULL","YES","varchar" +"636","information_schema","SYSTEM_VARIABLES","ENUM_VALUE_LIST",12,"NULL","YES","longtext" +"637","information_schema","SYSTEM_VARIABLES","READ_ONLY",13,"''","NO","varchar" +"638","information_schema","SYSTEM_VARIABLES","COMMAND_LINE_ARGUMENT",14,"NULL","YES","varchar" +"639","information_schema","SYSTEM_VARIABLES","GLOBAL_VALUE_PATH",15,"NULL","YES","varchar" +"640","information_schema","TABLES","TABLE_CATALOG",1,"''","NO","varchar" +"641","information_schema","TABLES","TABLE_SCHEMA",2,"''","NO","varchar" +"642","information_schema","TABLES","TABLE_NAME",3,"''","NO","varchar" +"643","information_schema","TABLES","TABLE_TYPE",4,"''","NO","varchar" +"644","information_schema","TABLES","ENGINE",5,"NULL","YES","varchar" +"645","information_schema","TABLES","VERSION",6,"NULL","YES","bigint" +"646","information_schema","TABLES","ROW_FORMAT",7,"NULL","YES","varchar" +"647","information_schema","TABLES","TABLE_ROWS",8,"NULL","YES","bigint" +"648","information_schema","TABLES","AVG_ROW_LENGTH",9,"NULL","YES","bigint" +"649","information_schema","TABLES","DATA_LENGTH",10,"NULL","YES","bigint" +"650","information_schema","TABLES","MAX_DATA_LENGTH",11,"NULL","YES","bigint" +"651","information_schema","TABLES","INDEX_LENGTH",12,"NULL","YES","bigint" +"652","information_schema","TABLES","DATA_FREE",13,"NULL","YES","bigint" +"653","information_schema","TABLES","AUTO_INCREMENT",14,"NULL","YES","bigint" +"654","information_schema","TABLES","CREATE_TIME",15,"NULL","YES","datetime" +"655","information_schema","TABLES","UPDATE_TIME",16,"NULL","YES","datetime" +"656","information_schema","TABLES","CHECK_TIME",17,"NULL","YES","datetime" +"657","information_schema","TABLES","TABLE_COLLATION",18,"NULL","YES","varchar" +"658","information_schema","TABLES","CHECKSUM",19,"NULL","YES","bigint" +"659","information_schema","TABLES","CREATE_OPTIONS",20,"NULL","YES","varchar" +"660","information_schema","TABLES","TABLE_COMMENT",21,"''","NO","varchar" +"661","information_schema","TABLES","MAX_INDEX_LENGTH",22,"NULL","YES","bigint" +"662","information_schema","TABLES","TEMPORARY",23,"NULL","YES","varchar" +"663","information_schema","TABLESPACES","TABLESPACE_NAME",1,"''","NO","varchar" +"664","information_schema","TABLESPACES","ENGINE",2,"''","NO","varchar" +"665","information_schema","TABLESPACES","TABLESPACE_TYPE",3,"NULL","YES","varchar" +"666","information_schema","TABLESPACES","LOGFILE_GROUP_NAME",4,"NULL","YES","varchar" +"667","information_schema","TABLESPACES","EXTENT_SIZE",5,"NULL","YES","bigint" +"668","information_schema","TABLESPACES","AUTOEXTEND_SIZE",6,"NULL","YES","bigint" +"669","information_schema","TABLESPACES","MAXIMUM_SIZE",7,"NULL","YES","bigint" +"670","information_schema","TABLESPACES","NODEGROUP_ID",8,"NULL","YES","bigint" +"671","information_schema","TABLESPACES","TABLESPACE_COMMENT",9,"NULL","YES","varchar" +"672","information_schema","TABLE_CONSTRAINTS","CONSTRAINT_CATALOG",1,"''","NO","varchar" +"673","information_schema","TABLE_CONSTRAINTS","CONSTRAINT_SCHEMA",2,"''","NO","varchar" +"674","information_schema","TABLE_CONSTRAINTS","CONSTRAINT_NAME",3,"''","NO","varchar" +"675","information_schema","TABLE_CONSTRAINTS","TABLE_SCHEMA",4,"''","NO","varchar" +"676","information_schema","TABLE_CONSTRAINTS","TABLE_NAME",5,"''","NO","varchar" +"677","information_schema","TABLE_CONSTRAINTS","CONSTRAINT_TYPE",6,"''","NO","varchar" +"678","information_schema","TABLE_PRIVILEGES","GRANTEE",1,"''","NO","varchar" +"679","information_schema","TABLE_PRIVILEGES","TABLE_CATALOG",2,"''","NO","varchar" +"680","information_schema","TABLE_PRIVILEGES","TABLE_SCHEMA",3,"''","NO","varchar" +"681","information_schema","TABLE_PRIVILEGES","TABLE_NAME",4,"''","NO","varchar" +"682","information_schema","TABLE_PRIVILEGES","PRIVILEGE_TYPE",5,"''","NO","varchar" +"683","information_schema","TABLE_PRIVILEGES","IS_GRANTABLE",6,"''","NO","varchar" +"684","information_schema","TABLE_STATISTICS","TABLE_SCHEMA",1,"''","NO","varchar" +"685","information_schema","TABLE_STATISTICS","TABLE_NAME",2,"''","NO","varchar" +"686","information_schema","TABLE_STATISTICS","ROWS_READ",3,"0","NO","bigint" +"687","information_schema","TABLE_STATISTICS","ROWS_CHANGED",4,"0","NO","bigint" +"688","information_schema","TABLE_STATISTICS","ROWS_CHANGED_X_INDEXES",5,"0","NO","bigint" +"689","information_schema","THREAD_POOL_GROUPS","GROUP_ID",1,"0","NO","int" +"690","information_schema","THREAD_POOL_GROUPS","CONNECTIONS",2,"0","NO","int" +"691","information_schema","THREAD_POOL_GROUPS","THREADS",3,"0","NO","int" +"692","information_schema","THREAD_POOL_GROUPS","ACTIVE_THREADS",4,"0","NO","int" +"693","information_schema","THREAD_POOL_GROUPS","STANDBY_THREADS",5,"0","NO","int" +"694","information_schema","THREAD_POOL_GROUPS","QUEUE_LENGTH",6,"0","NO","int" +"695","information_schema","THREAD_POOL_GROUPS","HAS_LISTENER",7,"0","NO","tinyint" +"696","information_schema","THREAD_POOL_GROUPS","IS_STALLED",8,"0","NO","tinyint" +"697","information_schema","THREAD_POOL_QUEUES","GROUP_ID",1,"0","NO","int" +"698","information_schema","THREAD_POOL_QUEUES","POSITION",2,"0","NO","int" +"699","information_schema","THREAD_POOL_QUEUES","PRIORITY",3,"0","NO","int" +"700","information_schema","THREAD_POOL_QUEUES","CONNECTION_ID",4,"NULL","YES","bigint" +"701","information_schema","THREAD_POOL_QUEUES","QUEUEING_TIME_MICROSECONDS",5,"0","NO","bigint" +"702","information_schema","THREAD_POOL_STATS","GROUP_ID",1,"0","NO","int" +"703","information_schema","THREAD_POOL_STATS","THREAD_CREATIONS",2,"0","NO","bigint" +"704","information_schema","THREAD_POOL_STATS","THREAD_CREATIONS_DUE_TO_STALL",3,"0","NO","bigint" +"705","information_schema","THREAD_POOL_STATS","WAKES",4,"0","NO","bigint" +"706","information_schema","THREAD_POOL_STATS","WAKES_DUE_TO_STALL",5,"0","NO","bigint" +"707","information_schema","THREAD_POOL_STATS","THROTTLES",6,"0","NO","bigint" +"708","information_schema","THREAD_POOL_STATS","STALLS",7,"0","NO","bigint" +"709","information_schema","THREAD_POOL_STATS","POLLS_BY_LISTENER",8,"0","NO","bigint" +"710","information_schema","THREAD_POOL_STATS","POLLS_BY_WORKER",9,"0","NO","bigint" +"711","information_schema","THREAD_POOL_STATS","DEQUEUES_BY_LISTENER",10,"0","NO","bigint" +"712","information_schema","THREAD_POOL_STATS","DEQUEUES_BY_WORKER",11,"0","NO","bigint" +"713","information_schema","THREAD_POOL_WAITS","REASON",1,"''","NO","varchar" +"714","information_schema","THREAD_POOL_WAITS","COUNT",2,"0","NO","bigint" +"715","information_schema","TRIGGERS","TRIGGER_CATALOG",1,"''","NO","varchar" +"716","information_schema","TRIGGERS","TRIGGER_SCHEMA",2,"''","NO","varchar" +"717","information_schema","TRIGGERS","TRIGGER_NAME",3,"''","NO","varchar" +"718","information_schema","TRIGGERS","EVENT_MANIPULATION",4,"''","NO","varchar" +"719","information_schema","TRIGGERS","EVENT_OBJECT_CATALOG",5,"''","NO","varchar" +"720","information_schema","TRIGGERS","EVENT_OBJECT_SCHEMA",6,"''","NO","varchar" +"721","information_schema","TRIGGERS","EVENT_OBJECT_TABLE",7,"''","NO","varchar" +"722","information_schema","TRIGGERS","ACTION_ORDER",8,"0","NO","bigint" +"723","information_schema","TRIGGERS","ACTION_CONDITION",9,"NULL","YES","longtext" +"724","information_schema","TRIGGERS","ACTION_STATEMENT",10,"''","NO","longtext" +"725","information_schema","TRIGGERS","ACTION_ORIENTATION",11,"''","NO","varchar" +"726","information_schema","TRIGGERS","ACTION_TIMING",12,"''","NO","varchar" +"727","information_schema","TRIGGERS","ACTION_REFERENCE_OLD_TABLE",13,"NULL","YES","varchar" +"728","information_schema","TRIGGERS","ACTION_REFERENCE_NEW_TABLE",14,"NULL","YES","varchar" +"729","information_schema","TRIGGERS","ACTION_REFERENCE_OLD_ROW",15,"''","NO","varchar" +"730","information_schema","TRIGGERS","ACTION_REFERENCE_NEW_ROW",16,"''","NO","varchar" +"731","information_schema","TRIGGERS","CREATED",17,"NULL","YES","datetime" +"732","information_schema","TRIGGERS","SQL_MODE",18,"''","NO","varchar" +"733","information_schema","TRIGGERS","DEFINER",19,"''","NO","varchar" +"734","information_schema","TRIGGERS","CHARACTER_SET_CLIENT",20,"''","NO","varchar" +"735","information_schema","TRIGGERS","COLLATION_CONNECTION",21,"''","NO","varchar" +"736","information_schema","TRIGGERS","DATABASE_COLLATION",22,"''","NO","varchar" +"737","information_schema","USER_PRIVILEGES","GRANTEE",1,"''","NO","varchar" +"738","information_schema","USER_PRIVILEGES","TABLE_CATALOG",2,"''","NO","varchar" +"739","information_schema","USER_PRIVILEGES","PRIVILEGE_TYPE",3,"''","NO","varchar" +"740","information_schema","USER_PRIVILEGES","IS_GRANTABLE",4,"''","NO","varchar" +"741","information_schema","USER_STATISTICS","USER",1,"''","NO","varchar" +"742","information_schema","USER_STATISTICS","TOTAL_CONNECTIONS",2,"0","NO","int" +"743","information_schema","USER_STATISTICS","CONCURRENT_CONNECTIONS",3,"0","NO","int" +"744","information_schema","USER_STATISTICS","CONNECTED_TIME",4,"0","NO","int" +"745","information_schema","USER_STATISTICS","BUSY_TIME",5,"0","NO","double" +"746","information_schema","USER_STATISTICS","CPU_TIME",6,"0","NO","double" +"747","information_schema","USER_STATISTICS","BYTES_RECEIVED",7,"0","NO","bigint" +"748","information_schema","USER_STATISTICS","BYTES_SENT",8,"0","NO","bigint" +"749","information_schema","USER_STATISTICS","BINLOG_BYTES_WRITTEN",9,"0","NO","bigint" +"750","information_schema","USER_STATISTICS","ROWS_READ",10,"0","NO","bigint" +"751","information_schema","USER_STATISTICS","ROWS_SENT",11,"0","NO","bigint" +"752","information_schema","USER_STATISTICS","ROWS_DELETED",12,"0","NO","bigint" +"753","information_schema","USER_STATISTICS","ROWS_INSERTED",13,"0","NO","bigint" +"754","information_schema","USER_STATISTICS","ROWS_UPDATED",14,"0","NO","bigint" +"755","information_schema","USER_STATISTICS","SELECT_COMMANDS",15,"0","NO","bigint" +"756","information_schema","USER_STATISTICS","UPDATE_COMMANDS",16,"0","NO","bigint" +"757","information_schema","USER_STATISTICS","OTHER_COMMANDS",17,"0","NO","bigint" +"758","information_schema","USER_STATISTICS","COMMIT_TRANSACTIONS",18,"0","NO","bigint" +"759","information_schema","USER_STATISTICS","ROLLBACK_TRANSACTIONS",19,"0","NO","bigint" +"760","information_schema","USER_STATISTICS","DENIED_CONNECTIONS",20,"0","NO","bigint" +"761","information_schema","USER_STATISTICS","LOST_CONNECTIONS",21,"0","NO","bigint" +"762","information_schema","USER_STATISTICS","ACCESS_DENIED",22,"0","NO","bigint" +"763","information_schema","USER_STATISTICS","EMPTY_QUERIES",23,"0","NO","bigint" +"764","information_schema","USER_STATISTICS","TOTAL_SSL_CONNECTIONS",24,"0","NO","bigint" +"765","information_schema","USER_STATISTICS","MAX_STATEMENT_TIME_EXCEEDED",25,"0","NO","bigint" +"766","information_schema","user_variables","VARIABLE_NAME",1,"''","NO","varchar" +"767","information_schema","user_variables","VARIABLE_VALUE",2,"NULL","YES","varchar" +"768","information_schema","user_variables","VARIABLE_TYPE",3,"''","NO","varchar" +"769","information_schema","user_variables","CHARACTER_SET_NAME",4,"NULL","YES","varchar" +"770","information_schema","VIEWS","TABLE_CATALOG",1,"''","NO","varchar" +"771","information_schema","VIEWS","TABLE_SCHEMA",2,"''","NO","varchar" +"772","information_schema","VIEWS","TABLE_NAME",3,"''","NO","varchar" +"773","information_schema","VIEWS","VIEW_DEFINITION",4,"''","NO","longtext" +"774","information_schema","VIEWS","CHECK_OPTION",5,"''","NO","varchar" +"775","information_schema","VIEWS","IS_UPDATABLE",6,"''","NO","varchar" +"776","information_schema","VIEWS","DEFINER",7,"''","NO","varchar" +"777","information_schema","VIEWS","SECURITY_TYPE",8,"''","NO","varchar" +"778","information_schema","VIEWS","CHARACTER_SET_CLIENT",9,"''","NO","varchar" +"779","information_schema","VIEWS","COLLATION_CONNECTION",10,"''","NO","varchar" +"780","information_schema","VIEWS","ALGORITHM",11,"''","NO","varchar" From d4af44a3f5e8b234d74afd274b0a4bbd7f12c29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 19 Jun 2022 06:24:50 +0200 Subject: [PATCH 06/23] Unlock schema learning and tests --- R/db-helpers.R | 2 +- tests/testthat/test-learn.R | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/db-helpers.R b/R/db-helpers.R index b095ff7b1..32d58b4a6 100644 --- a/R/db-helpers.R +++ b/R/db-helpers.R @@ -91,7 +91,7 @@ repair_table_names_for_db <- function(table_names, temporary, con, schema = NULL names <- unique_db_table_name(names) } else { # permanent tables - if (!is.null(schema) && !is_mssql(con) && !is_postgres(con)) { + if (!is.null(schema) && !is_mssql(con) && !is_postgres(con) && !is_mariadb(con)) { abort_no_schemas_supported(con = con) } names <- table_names diff --git a/tests/testthat/test-learn.R b/tests/testthat/test-learn.R index 0ef1b3dad..50c666de3 100644 --- a/tests/testthat/test-learn.R +++ b/tests/testthat/test-learn.R @@ -1,7 +1,7 @@ # FIXME: #313: learn only from current source test_that("Standard learning from MSSQL (schema 'dbo') or Postgres (schema 'public') and get_src_tbl_names() works?", { - skip_if_src_not(c("mssql", "postgres")) + skip_if_src_not(c("mssql", "postgres", "maria")) # dm_learn_from_mssql() -------------------------------------------------- con_db <- my_test_con() @@ -42,7 +42,7 @@ test_that("Standard learning from MSSQL (schema 'dbo') or Postgres (schema 'publ }) test_that("Standard learning from MSSQL (schema 'dbo') or Postgres (schema 'public') and get_src_tbl_names() works?", { - skip_if_src_not(c("mssql", "postgres")) + skip_if_src_not(c("mssql", "postgres", "maria")) # dm_learn_from_mssql() -------------------------------------------------- con_db <- my_test_con() @@ -109,7 +109,7 @@ test_that("Standard learning from MSSQL (schema 'dbo') or Postgres (schema 'publ test_that("Learning from specific schema on MSSQL or Postgres works?", { - skip_if_src_not(c("mssql", "postgres")) + skip_if_src_not(c("mssql", "postgres", "maria")) # produces a randomized schema name with a length of 4-10 characters # consisting of the symbols in `reservoir` From 4123f131d3f236d6cf9b6560d25b1d0fc9e55591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 19 Jun 2022 08:43:00 +0200 Subject: [PATCH 07/23] Snapshot meta dm --- tests/testthat/test-meta.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-meta.R b/tests/testthat/test-meta.R index f8ac9043b..cb72a23ad 100644 --- a/tests/testthat/test-meta.R +++ b/tests/testthat/test-meta.R @@ -6,7 +6,7 @@ test_that("dummy", { }) test_that("dm_meta() data model", { - skip_if_src_not(c("mssql", "postgres")) + skip_if_src_not(c("mssql", "postgres", "maria")) expect_snapshot({ dm_meta(my_test_src()) %>% From 400118989ce28cfe06af836bc7055c74957b0c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 19 Jun 2022 11:50:41 +0200 Subject: [PATCH 08/23] Fix casing --- R/meta.R | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/R/meta.R b/R/meta.R index 27a40fe01..6da735be3 100644 --- a/R/meta.R +++ b/R/meta.R @@ -73,7 +73,10 @@ dm_meta_raw <- function(con, catalog) { "table_name", "constraint_type" )) %>% mutate(table_catalog = constraint_catalog, table_schema = constraint_schema, .before = table_name) %>% - mutate(constraint_name = if_else(constraint_type == "PRIMARY KEY", paste0("pk_", table_name), constraint_name)) + mutate(constraint_name = if_else(constraint_type == "PRIMARY KEY", paste0("pk_", table_name), constraint_name)) %>% + # WAT + mutate(constraint_schema = tolower(constraint_schema)) %>% + mutate(table_schema = tolower(table_schema)) } else { table_constraints <- tbl_lc(src, "information_schema.table_constraints", vars = vec_c( "constraint_catalog", "constraint_schema", "constraint_name", @@ -127,7 +130,10 @@ dm_meta_raw <- function(con, catalog) { table_schema = referenced_table_schema, table_name = referenced_table_name, column_name = referenced_column_name, - ) + ) %>% + # WAT + mutate(constraint_schema = tolower(constraint_schema)) %>% + mutate(table_schema = tolower(table_schema)) } dm(schemata, tables, columns, table_constraints, key_column_usage, constraint_column_usage) %>% From 6f4ccea5d9ea4e6093b286cf85d570f9f1262d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 19 Jun 2022 11:50:47 +0200 Subject: [PATCH 09/23] Auto-learning --- R/meta.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/R/meta.R b/R/meta.R index 6da735be3..2894724ec 100644 --- a/R/meta.R +++ b/R/meta.R @@ -208,7 +208,13 @@ tbl_lc <- function(con, name, vars) { )) } - tbl(con, from, vars = vars) + out <- tbl(con, from, vars = vars) + if (is.null(vars)) { + out <- + out %>% + rename(!!!set_names(colnames(out), tolower(colnames(out)))) + } + out } select_dm_meta <- function(dm_meta) { From 1f9773f8791f4078a8e237bd50b59902b0eca626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 19 Jun 2022 15:23:02 +0200 Subject: [PATCH 10/23] Skip --- tests/testthat/test-db-interface.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-db-interface.R b/tests/testthat/test-db-interface.R index e2d3a8a02..b6a864b5e 100644 --- a/tests/testthat/test-db-interface.R +++ b/tests/testthat/test-db-interface.R @@ -183,7 +183,7 @@ test_that("copy_dm_to() works with schema argument for MSSQL & Postgres", { }) test_that("copy_dm_to() fails with schema argument for databases other than MSSQL & Postgres", { - skip_if_src("mssql", "postgres") + skip_if_src("mssql", "postgres", "maria") local_dm <- dm_for_filter() %>% collect() From 7ce021be0b68b06990ef231ee9e15fd60f47eb9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 19 Jun 2022 15:23:08 +0200 Subject: [PATCH 11/23] Last test --- tests/testthat/test-learn.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-learn.R b/tests/testthat/test-learn.R index 50c666de3..eb756c4e3 100644 --- a/tests/testthat/test-learn.R +++ b/tests/testthat/test-learn.R @@ -147,10 +147,14 @@ test_that("Learning from specific schema on MSSQL or Postgres works?", { try(dbExecute(con_db, paste0("DROP SCHEMA ", schema_name_q))) }) + normalize_table_name <- function(x) { + tolower(gsub('["`]', "", x)) + } + # test 'get_src_tbl_names()' expect_identical( - sort(get_src_tbl_names(con_db, schema = schema_name)), - SQL(sort(remote_tbl_names)) + sort(normalize_table_name(get_src_tbl_names(con_db, schema = schema_name))), + SQL(sort(normalize_table_name(remote_tbl_names))) ) # learning with keys: From 5caa14b285601e30bffce404e7ee222e1d59c297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 19 Jun 2022 16:57:51 +0200 Subject: [PATCH 12/23] Global variables --- R/global.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/global.R b/R/global.R index 1a8adc802..95aeb6393 100644 --- a/R/global.R +++ b/R/global.R @@ -163,6 +163,11 @@ utils::globalVariables(c( "remote_table", "remote_table_unquoted", "unique_def", + # + # meta + "referenced_column_name", + "referenced_table_name", + "referenced_table_schema", # # keep this to avoid dealing with trailing commas NULL From 56e0d04ae3e2c5037e6f7aaf8f661cd46c420fa5 Mon Sep 17 00:00:00 2001 From: krlmlr Date: Sun, 19 Jun 2022 15:02:23 +0000 Subject: [PATCH 13/23] Auto-update from GitHub Actions Run: https://github.com/cynkra/dm/actions/runs/2524367363 --- R/global.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/global.R b/R/global.R index 95aeb6393..79c481fca 100644 --- a/R/global.R +++ b/R/global.R @@ -165,9 +165,9 @@ utils::globalVariables(c( "unique_def", # # meta - "referenced_column_name", - "referenced_table_name", - "referenced_table_schema", + "referenced_column_name", + "referenced_table_name", + "referenced_table_schema", # # keep this to avoid dealing with trailing commas NULL From 921a5b8cc983bb02cd11fda71318a4701f3fe81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 05:33:21 +0200 Subject: [PATCH 14/23] If database is selected for the connection, learn only from that database --- R/meta.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/R/meta.R b/R/meta.R index 2894724ec..a58e97ce7 100644 --- a/R/meta.R +++ b/R/meta.R @@ -254,6 +254,13 @@ filter_dm_meta <- function(dm_meta, catalog = NULL, schema = NULL) { table_constraints <- table_constraints %>% filter(table_schema %in% !!schema) key_column_usage <- key_column_usage %>% filter(table_schema %in% !!schema) constraint_column_usage <- constraint_column_usage %>% filter(table_schema %in% !!schema) + } else if (is_mariadb(dm_get_con(dm_meta))) { + schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) + tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + table_constraints <- table_constraints %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + key_column_usage <- key_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + constraint_column_usage <- constraint_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) } dm( @@ -285,6 +292,10 @@ filter_dm_meta_simple <- function(dm_meta, catalog = NULL, schema = NULL) { schemata <- schemata %>% filter(schema_name %in% !!schema) tables <- tables %>% filter(table_schema %in% !!schema) columns <- columns %>% filter(table_schema %in% !!schema) + } else if (is_mariadb(dm_get_con(dm_meta))) { + schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) + tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) } dm(schemata, tables, columns) %>% From 528c339f803a7ae118b536eb9532d9505736843f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 05:39:58 +0200 Subject: [PATCH 15/23] Remove workaround --- R/meta.R | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/R/meta.R b/R/meta.R index a58e97ce7..a1e642d31 100644 --- a/R/meta.R +++ b/R/meta.R @@ -73,10 +73,7 @@ dm_meta_raw <- function(con, catalog) { "table_name", "constraint_type" )) %>% mutate(table_catalog = constraint_catalog, table_schema = constraint_schema, .before = table_name) %>% - mutate(constraint_name = if_else(constraint_type == "PRIMARY KEY", paste0("pk_", table_name), constraint_name)) %>% - # WAT - mutate(constraint_schema = tolower(constraint_schema)) %>% - mutate(table_schema = tolower(table_schema)) + mutate(constraint_name = if_else(constraint_type == "PRIMARY KEY", paste0("pk_", table_name), constraint_name)) } else { table_constraints <- tbl_lc(src, "information_schema.table_constraints", vars = vec_c( "constraint_catalog", "constraint_schema", "constraint_name", @@ -130,10 +127,7 @@ dm_meta_raw <- function(con, catalog) { table_schema = referenced_table_schema, table_name = referenced_table_name, column_name = referenced_column_name, - ) %>% - # WAT - mutate(constraint_schema = tolower(constraint_schema)) %>% - mutate(table_schema = tolower(table_schema)) + ) } dm(schemata, tables, columns, table_constraints, key_column_usage, constraint_column_usage) %>% From fe32bdf0f0faa62f3547a2b55472a6e9dcd19741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 05:40:04 +0200 Subject: [PATCH 16/23] Hide --- vignettes/dm.Rmd | 2 +- vignettes/howto-dm-db.Rmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vignettes/dm.Rmd b/vignettes/dm.Rmd index 4de8b9560..fecb61c8d 100644 --- a/vignettes/dm.Rmd +++ b/vignettes/dm.Rmd @@ -40,7 +40,7 @@ fin_db <- dbConnect( ) `````` -``````{r connect-real} +``````{r connect-real, show = FALSE} library(RMariaDB) fin_db <- dm:::financial_db_con() diff --git a/vignettes/howto-dm-db.Rmd b/vignettes/howto-dm-db.Rmd index d19ae8f41..7658376d7 100644 --- a/vignettes/howto-dm-db.Rmd +++ b/vignettes/howto-dm-db.Rmd @@ -45,7 +45,7 @@ my_db <- dbConnect( ) `````` -``````{r } +``````{r show = FALSE} library(RMariaDB) my_db <- dm:::financial_db_con() `````` From f6575932cc311d1bfb5302c1777eb22bf9f61837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 05:50:03 +0200 Subject: [PATCH 17/23] Split example --- vignettes/dm.Rmd | 14 +++++++++++--- vignettes/howto-dm-db.Rmd | 13 ++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/vignettes/dm.Rmd b/vignettes/dm.Rmd index fecb61c8d..81d24da68 100644 --- a/vignettes/dm.Rmd +++ b/vignettes/dm.Rmd @@ -48,15 +48,14 @@ fin_db <- dm:::financial_db_con() We create a dm object from an RDBMS using `dm_from_con()`, passing in the connection object we just created as the first argument. -``````{r load, message = FALSE} +``````{r load-full} library(dm) fin_dm <- dm_from_con(fin_db) fin_dm `````` -The dm object interrogates the RDBMS for table and column information and, where implemented, primary and foreign keys. -Currently, primary and foreign keys are only available from Postgres and SQL Server. +The dm object interrogates the RDBMS for table and column information, and primary and foreign keys. ## Selecting tables @@ -84,6 +83,15 @@ fin_dm_small <- In many cases, `dm_from_con()` already returns a dm with all keys set. If not, dm allows us to define primary and foreign keys ourselves. +For this, we use `learn_keys = FALSE` to obtain a `dm` object with only the tables. + +``````{r load} +library(dm) + +fin_dm_small <- + dm_from_con(fin_db, learn_keys = FALSE) %>% + dm_select_tbl(loans, accounts, districts, trans) +`````` In our data model, `id` columns uniquely identify records in the `accounts` and `loans` tables, and can be used as a primary key. A primary key is defined with `dm_add_pk()`. diff --git a/vignettes/howto-dm-db.Rmd b/vignettes/howto-dm-db.Rmd index 7658376d7..d087ef721 100644 --- a/vignettes/howto-dm-db.Rmd +++ b/vignettes/howto-dm-db.Rmd @@ -52,7 +52,7 @@ my_db <- dm:::financial_db_con() Creating a dm object takes a single call to `dm_from_con()` with the DBI connection object as its argument. -``````{r message = FALSE} +``````{r} library(dm) my_dm <- dm_from_con(my_db) @@ -92,6 +92,17 @@ Foreign keys act as cross references between tables. They specify the relationships that gives us the *relational* database. For more information on keys and a crash course on databases, see `vignette("howto-dm-theory")`. +In many cases, `dm_from_con()` already returns a dm with all keys set. +If not, dm allows us to define primary and foreign keys ourselves. +For this, we use `learn_keys = FALSE` to obtain a `dm` object with only the tables. + +``````{r load} +library(dm) + +fin_dm <- dm_from_con(my_db, learn_keys = FALSE) +fin_dm +`````` + The `r href("model diagram", "https://relational.fit.cvut.cz/assets/img/datasets-generated/financial.svg")` provided by our test database loosely illustrates the intended relationships between tables. In the diagram, we can see that the `loans` table should be linked to the `accounts` table. Below, we create those links in 3 steps: From 83c5020f44e4b15f665743eb1e939f5bf54339ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 05:56:56 +0200 Subject: [PATCH 18/23] Simplify --- tests/testthat/test-learn.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-learn.R b/tests/testthat/test-learn.R index eb756c4e3..45cb439e9 100644 --- a/tests/testthat/test-learn.R +++ b/tests/testthat/test-learn.R @@ -114,8 +114,8 @@ test_that("Learning from specific schema on MSSQL or Postgres works?", { # produces a randomized schema name with a length of 4-10 characters # consisting of the symbols in `reservoir` random_schema <- function() { - reservoir <- c(letters, LETTERS, "'", "-", "_", as.character(0:9)) - how_long <- sample(4:10, 1) + reservoir <- c(letters) + how_long <- 10 paste0(reservoir[sample(seq_len(length(reservoir)), how_long, replace = TRUE)], collapse = "") } @@ -411,8 +411,8 @@ test_that("dm_meta() contents", { # produces a randomized schema name with a length of 4-10 characters # consisting of the symbols in `reservoir` random_schema <- function() { - reservoir <- c(letters, LETTERS, "'", "-", "_", as.character(0:9)) - how_long <- sample(4:10, 1) + reservoir <- c(letters) + how_long <- 10 paste0(reservoir[sample(seq_len(length(reservoir)), how_long, replace = TRUE)], collapse = "") } From 78aa189b4adfb9edfaacdef891410a82d237c74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 06:07:57 +0200 Subject: [PATCH 19/23] Support schema = NA --- R/meta.R | 74 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/R/meta.R b/R/meta.R index a1e642d31..8af4f941b 100644 --- a/R/meta.R +++ b/R/meta.R @@ -232,29 +232,33 @@ filter_dm_meta <- function(dm_meta, catalog = NULL, schema = NULL) { key_column_usage <- dm_meta$key_column_usage constraint_column_usage <- dm_meta$constraint_column_usage - if (!is.null(catalog) && !is.na(catalog)) { - schemata <- schemata %>% filter(catalog_name %in% !!catalog) - tables <- tables %>% filter(table_catalog %in% !!catalog) - columns <- columns %>% filter(table_catalog %in% !!catalog) - table_constraints <- table_constraints %>% filter(table_catalog %in% !!catalog) - key_column_usage <- key_column_usage %>% filter(table_catalog %in% !!catalog) - constraint_column_usage <- constraint_column_usage %>% filter(table_catalog %in% !!catalog) + if (!is.na(catalog)) { + if (!is.null(catalog)) { + schemata <- schemata %>% filter(catalog_name %in% !!catalog) + tables <- tables %>% filter(table_catalog %in% !!catalog) + columns <- columns %>% filter(table_catalog %in% !!catalog) + table_constraints <- table_constraints %>% filter(table_catalog %in% !!catalog) + key_column_usage <- key_column_usage %>% filter(table_catalog %in% !!catalog) + constraint_column_usage <- constraint_column_usage %>% filter(table_catalog %in% !!catalog) + } } - if (!is.null(schema)) { - schemata <- schemata %>% filter(schema_name %in% !!schema) - tables <- tables %>% filter(table_schema %in% !!schema) - columns <- columns %>% filter(table_schema %in% !!schema) - table_constraints <- table_constraints %>% filter(table_schema %in% !!schema) - key_column_usage <- key_column_usage %>% filter(table_schema %in% !!schema) - constraint_column_usage <- constraint_column_usage %>% filter(table_schema %in% !!schema) - } else if (is_mariadb(dm_get_con(dm_meta))) { - schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) - tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - table_constraints <- table_constraints %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - key_column_usage <- key_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - constraint_column_usage <- constraint_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + if (!is.na(schema)) { + if (!is.null(schema)) { + schemata <- schemata %>% filter(schema_name %in% !!schema) + tables <- tables %>% filter(table_schema %in% !!schema) + columns <- columns %>% filter(table_schema %in% !!schema) + table_constraints <- table_constraints %>% filter(table_schema %in% !!schema) + key_column_usage <- key_column_usage %>% filter(table_schema %in% !!schema) + constraint_column_usage <- constraint_column_usage %>% filter(table_schema %in% !!schema) + } else if (is_mariadb(dm_get_con(dm_meta))) { + schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) + tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + table_constraints <- table_constraints %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + key_column_usage <- key_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + constraint_column_usage <- constraint_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + } } dm( @@ -276,20 +280,24 @@ filter_dm_meta_simple <- function(dm_meta, catalog = NULL, schema = NULL) { tables <- dm_meta$tables columns <- dm_meta$columns - if (!is.null(catalog) && !is.na(catalog)) { - schemata <- schemata %>% filter(catalog_name %in% !!catalog) - tables <- tables %>% filter(table_catalog %in% !!catalog) - columns <- columns %>% filter(table_catalog %in% !!catalog) + if (!is.na(catalog)) { + if (!is.null(catalog)) { + schemata <- schemata %>% filter(catalog_name %in% !!catalog) + tables <- tables %>% filter(table_catalog %in% !!catalog) + columns <- columns %>% filter(table_catalog %in% !!catalog) + } } - if (!is.null(schema)) { - schemata <- schemata %>% filter(schema_name %in% !!schema) - tables <- tables %>% filter(table_schema %in% !!schema) - columns <- columns %>% filter(table_schema %in% !!schema) - } else if (is_mariadb(dm_get_con(dm_meta))) { - schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) - tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + if (!is.na(schema)) { + if (!is.null(schema)) { + schemata <- schemata %>% filter(schema_name %in% !!schema) + tables <- tables %>% filter(table_schema %in% !!schema) + columns <- columns %>% filter(table_schema %in% !!schema) + } else if (is_mariadb(dm_get_con(dm_meta))) { + schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) + tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + } } dm(schemata, tables, columns) %>% From 9b1db279c05f022804ddd53670c42aaf06999d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 06:09:13 +0200 Subject: [PATCH 20/23] Please --- R/global.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/global.R b/R/global.R index 79c481fca..52c3cd666 100644 --- a/R/global.R +++ b/R/global.R @@ -165,6 +165,7 @@ utils::globalVariables(c( "unique_def", # # meta + "DATABASE", "referenced_column_name", "referenced_table_name", "referenced_table_schema", From 337de7a326e6c46061c19d48fb0181d8070072d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 06:12:26 +0200 Subject: [PATCH 21/23] Support Dolt --- R/db-helpers.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/db-helpers.R b/R/db-helpers.R index 32d58b4a6..24ca6520d 100644 --- a/R/db-helpers.R +++ b/R/db-helpers.R @@ -65,8 +65,7 @@ is_postgres <- function(dest) { } is_mariadb <- function(dest) { - inherits(dest, "src_MariaDBConnection") || - inherits(dest, "MariaDBConnection") + inherits_any(dest, c("src_MariaDBConnection", "MariaDBConnection", "src_DoltConnection", "src_DoltLocalConnection")) } src_from_src_or_con <- function(dest) { From 204ab980ffffbbd6a9c32ff6a67a841a9e387e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 06:13:32 +0200 Subject: [PATCH 22/23] Avoid surprise --- R/db-helpers.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/db-helpers.R b/R/db-helpers.R index 24ca6520d..0b1073c2a 100644 --- a/R/db-helpers.R +++ b/R/db-helpers.R @@ -65,7 +65,7 @@ is_postgres <- function(dest) { } is_mariadb <- function(dest) { - inherits_any(dest, c("src_MariaDBConnection", "MariaDBConnection", "src_DoltConnection", "src_DoltLocalConnection")) + inherits_any(dest, c("MariaDBConnection", "src_MariaDBConnection", "src_DoltConnection", "src_DoltLocalConnection")) } src_from_src_or_con <- function(dest) { From 1edd020a7a0e7de4b3d89da9265a48999e3f258e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 21 Jun 2022 06:30:15 +0200 Subject: [PATCH 23/23] Safety --- R/meta.R | 74 +++++++++++++++++++++++++------------------------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/R/meta.R b/R/meta.R index 8af4f941b..04db26ba9 100644 --- a/R/meta.R +++ b/R/meta.R @@ -232,33 +232,29 @@ filter_dm_meta <- function(dm_meta, catalog = NULL, schema = NULL) { key_column_usage <- dm_meta$key_column_usage constraint_column_usage <- dm_meta$constraint_column_usage - if (!is.na(catalog)) { - if (!is.null(catalog)) { - schemata <- schemata %>% filter(catalog_name %in% !!catalog) - tables <- tables %>% filter(table_catalog %in% !!catalog) - columns <- columns %>% filter(table_catalog %in% !!catalog) - table_constraints <- table_constraints %>% filter(table_catalog %in% !!catalog) - key_column_usage <- key_column_usage %>% filter(table_catalog %in% !!catalog) - constraint_column_usage <- constraint_column_usage %>% filter(table_catalog %in% !!catalog) - } + if (!is.null(catalog) && !is.na(catalog)) { + schemata <- schemata %>% filter(catalog_name %in% !!catalog) + tables <- tables %>% filter(table_catalog %in% !!catalog) + columns <- columns %>% filter(table_catalog %in% !!catalog) + table_constraints <- table_constraints %>% filter(table_catalog %in% !!catalog) + key_column_usage <- key_column_usage %>% filter(table_catalog %in% !!catalog) + constraint_column_usage <- constraint_column_usage %>% filter(table_catalog %in% !!catalog) } - if (!is.na(schema)) { - if (!is.null(schema)) { - schemata <- schemata %>% filter(schema_name %in% !!schema) - tables <- tables %>% filter(table_schema %in% !!schema) - columns <- columns %>% filter(table_schema %in% !!schema) - table_constraints <- table_constraints %>% filter(table_schema %in% !!schema) - key_column_usage <- key_column_usage %>% filter(table_schema %in% !!schema) - constraint_column_usage <- constraint_column_usage %>% filter(table_schema %in% !!schema) - } else if (is_mariadb(dm_get_con(dm_meta))) { - schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) - tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - table_constraints <- table_constraints %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - key_column_usage <- key_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - constraint_column_usage <- constraint_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - } + if (!is.null(schema) && !is.na(schema)) { + schemata <- schemata %>% filter(schema_name %in% !!schema) + tables <- tables %>% filter(table_schema %in% !!schema) + columns <- columns %>% filter(table_schema %in% !!schema) + table_constraints <- table_constraints %>% filter(table_schema %in% !!schema) + key_column_usage <- key_column_usage %>% filter(table_schema %in% !!schema) + constraint_column_usage <- constraint_column_usage %>% filter(table_schema %in% !!schema) + } else if (!is.na(schema) && is_mariadb(dm_get_con(dm_meta))) { + schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) + tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + table_constraints <- table_constraints %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + key_column_usage <- key_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + constraint_column_usage <- constraint_column_usage %>% filter(table_schema == DATABASE() | is.na(DATABASE())) } dm( @@ -280,24 +276,20 @@ filter_dm_meta_simple <- function(dm_meta, catalog = NULL, schema = NULL) { tables <- dm_meta$tables columns <- dm_meta$columns - if (!is.na(catalog)) { - if (!is.null(catalog)) { - schemata <- schemata %>% filter(catalog_name %in% !!catalog) - tables <- tables %>% filter(table_catalog %in% !!catalog) - columns <- columns %>% filter(table_catalog %in% !!catalog) - } + if (!is.null(catalog) && !is.na(catalog)) { + schemata <- schemata %>% filter(catalog_name %in% !!catalog) + tables <- tables %>% filter(table_catalog %in% !!catalog) + columns <- columns %>% filter(table_catalog %in% !!catalog) } - if (!is.na(schema)) { - if (!is.null(schema)) { - schemata <- schemata %>% filter(schema_name %in% !!schema) - tables <- tables %>% filter(table_schema %in% !!schema) - columns <- columns %>% filter(table_schema %in% !!schema) - } else if (is_mariadb(dm_get_con(dm_meta))) { - schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) - tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) - } + if (!is.null(schema)) { + schemata <- schemata %>% filter(schema_name %in% !!schema) + tables <- tables %>% filter(table_schema %in% !!schema) + columns <- columns %>% filter(table_schema %in% !!schema) + } else if (!is.na(schema) && is_mariadb(dm_get_con(dm_meta))) { + schemata <- schemata %>% filter(schema_name == DATABASE() | is.na(DATABASE())) + tables <- tables %>% filter(table_schema == DATABASE() | is.na(DATABASE())) + columns <- columns %>% filter(table_schema == DATABASE() | is.na(DATABASE())) } dm(schemata, tables, columns) %>%