Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Typedefs | Functions | Variables
basic::database Namespace Reference

Namespaces

 insert_statement_generator
 
 schema_generator
 

Classes

class  DatabaseSessionLoader
 
class  DatabaseSessionLoaderCreator
 
class  DatabaseSessionOptions
 

Typedefs

typedef
utility::pointer::shared_ptr
< DatabaseSessionLoader
DatabaseSessionLoaderOP
 
typedef
utility::pointer::shared_ptr
< DatabaseSessionLoader const > 
DatabaseSessionLoaderCOP
 
typedef
utility::pointer::shared_ptr
< DatabaseSessionOptions
DatabaseSessionOptionsOP
 
typedef
utility::pointer::shared_ptr
< DatabaseSessionOptions const > 
DatabaseSessionOptionsCOP
 

Functions

bool open (utility::io::izstream &db_stream, std::string const &db_file, bool warn)
 Open a database file on a provided stream. More...
 
std::string full_name (std::string const &db_file, bool warn)
 Full-path database file name. More...
 
std::string find_database_path (std::string const &dir, std::string const &filename, bool const mute_error_if_failure)
 Find a path to a file. More...
 
std::string find_database_path (std::string const &dir, std::string const &filename, std::string const &ext)
 Find a path to a file. More...
 
bool find_cache_file (std::string const &cache_file, bool dir_only)
 Does cache file (absolute path) exist? if dir_only is true, will return true if the cache file could be created. More...
 
std::string full_cache_name (std::string const &short_name, std::string const &source_file, bool for_writing)
 Get the (absolute) path to a given cached file. If source_file is given, it's the full path to the source database file that's being cached. If for_writing is true, will only check that the given file would be creatable. Will return an empty string if it can't find a cache file. More...
 
sessionOP get_db_session ()
 Aquire a database session using the command line options transaction type is set to standard. More...
 
sessionOP get_db_session (std::string const &db_name, std::string const &pq_schema="")
 Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. Transaction type set to standard. More...
 
sessionOP get_db_session (string const &db_name, TransactionMode::e transaction_mode, Size chunk_size, string const &pq_schema)
 
utility::sql_database::sessionOP get_db_session (utility::sql_database::DatabaseMode::e db_mode, std::string const &db_name, std::string const &pq_schema)
 
sessionOP get_db_session (DatabaseMode::e db_mode, TransactionMode::e transaction_mode, Size chunk_size, string const &db_name, string const &pq_schema)
 
platform::SSize db_partition_from_options (DatabaseMode::e db_mode)
 @ More...
 
platform::SSize resolve_db_partition (bool partition_by_mpi_process, platform::SSize manual_partition=-1)
 Returns partition identifer from mpi rank if in partitioned database mode, or valid manual partition, otherwise -1. More...
 
statement safely_prepare_statement (string const &statement_string, sessionOP db_session)
 
statement prepare_statement_no_catch (string const &statement_string, sessionOP db_session)
 
void safely_write_to_database (statement &statement)
 
result safely_read_from_database (statement &statement)
 
bool table_exists (sessionOP db_session, string const &table_name)
 
void check_statement_sanity (string sql)
 
void insert_or_ignore (string table_name, std::vector< string > column_names, std::vector< string > values, sessionOP db_session)
 
void write_schema_to_database (string schema_str, sessionOP db_session)
 
void set_cache_size (sessionOP db_session, Size cache_size)
 
std::string make_compound_statement (std::string const &table_name, std::vector< std::string > const &column_names, platform::Size const &row_count)
 
utility::sql_database::sessionOP parse_database_connection (utility::tag::TagCOP tag)
 
void attributes_for_parse_database_connection (utility::tag::AttributeList &attlist, utility::tag::XMLSchemaDefinition &xsd)
 
utility::sql_database::sessionOP get_db_session (std::string const &db_name, utility::sql_database::TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &pq_schema="")
 Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. More...
 
utility::sql_database::sessionOP get_db_session (utility::sql_database::DatabaseMode::e db_mode, utility::sql_database::TransactionMode::e transaction_mode, platform::Size chunk_size, std::string const &db_name, std::string const &pq_schema="")
 Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. More...
 
cppdb::statement safely_prepare_statement (std::string const &statement_string, utility::sql_database::sessionOP db_session)
 
cppdb::statement prepare_statement_no_catch (std::string const &statement_string, utility::sql_database::sessionOP db_session)
 Do not catch the error - leave the catch for the code using it. Do not use this unless YOU are catching any erorrs (cppdb::error). More...
 
void safely_write_to_database (cppdb::statement &statement)
 
cppdb::result safely_read_from_database (cppdb::statement &statement)
 
void insert_or_ignore (std::string table_name, std::vector< std::string > column_names, std::vector< std::string > values, utility::sql_database::sessionOP db_session)
 
bool table_exists (utility::sql_database::sessionOP db_session, std::string const &table_name)
 
void set_cache_size (utility::sql_database::sessionOP db_session, platform::Size cache_size)
 set the number of 1kb pages to use for cache More...
 
void write_schema_to_database (std::string schema, utility::sql_database::sessionOP db_session)
 

Variables

static basic::Tracer TR ("basic.io.database")
 
static basic::Tracer TR ("basic.database.sql_utils")
 

Typedef Documentation

Function Documentation

void basic::database::attributes_for_parse_database_connection ( utility::tag::AttributeList attlist,
utility::tag::XMLSchemaDefinition xsd 
)
void basic::database::check_statement_sanity ( string  sql)
platform::SSize basic::database::db_partition_from_options ( DatabaseMode::e  db_mode)
bool basic::database::find_cache_file ( std::string const &  cache_file,
bool  dir_only 
)
std::string basic::database::find_database_path ( std::string const &  dir,
std::string const &  filename,
bool const  mute_error_if_failure 
)

Find a path to a file.

Try various combinations to locate the specific file being requested by the user. (inspired by core::scoring::ScoreFunction::find_weights_file())

Labonte JWLab.nosp@m.onte.nosp@m.@jhu..nosp@m.edu

Try various combinations to locate the specific file being requested by the user. (inspired by core::scoring::ScoreFunction::find_weights_file())

mute_error_if_failure returns "" if the file does not exist instead of throwing a loud exception

dir like chemical/carbohydrates/linkage_conformers/

References test.G202_Module_PythonPDB::filename, full_name(), utility::io::izstream::good(), basic::options::OptionKeys::in::path::path, and utility_exit_with_message.

std::string basic::database::find_database_path ( std::string const &  dir,
std::string const &  filename,
std::string const &  ext 
)

Find a path to a file.

Try various combinations to locate the specific file being requested by the user. (inspired by core::scoring::ScoreFunction::find_weights_file())

Labonte JWLab.nosp@m.onte.nosp@m.@jhu..nosp@m.edu

Try various combinations to locate the specific file being requested by the user. (inspired by core::scoring::ScoreFunction::find_weights_file())

dir like chemical/carbohydrates/linkage_conformers/

References test.G202_Module_PythonPDB::filename, full_name(), utility::io::izstream::good(), basic::options::OptionKeys::in::path::path, and utility_exit_with_message.

std::string basic::database::full_cache_name ( std::string const &  short_name,
std::string const &  source_file,
bool  for_writing 
)

Get the (absolute) path to a given cached file. If source_file is given, it's the full path to the source database file that's being cached. If for_writing is true, will only check that the given file would be creatable. Will return an empty string if it can't find a cache file.

References utility::file::FileName::bare_name(), in::path::database_cache_dir(), find_cache_file(), utility::file::get_home_dir(), option, options, basic::options::OptionKeys::in::path::path, utility::file::FileName::path(), and basic::options::OptionKeys::inout::dbms::user.

std::string basic::database::full_name ( std::string const &  db_file,
bool  warn 
)
utility::sql_database::sessionOP basic::database::get_db_session ( std::string const &  db_name,
utility::sql_database::TransactionMode::e  transaction_mode,
platform::Size  chunk_size,
std::string const &  pq_schema = "" 
)

Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database.

utility::sql_database::sessionOP basic::database::get_db_session ( utility::sql_database::DatabaseMode::e  db_mode,
utility::sql_database::TransactionMode::e  transaction_mode,
platform::Size  chunk_size,
std::string const &  db_name,
std::string const &  pq_schema = "" 
)

Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database.

utility::sql_database::sessionOP basic::database::get_db_session ( )

Aquire a database session using the command line options transaction type is set to standard.

References inout::dbms::database_name(), get_db_session(), option, options, inout::dbms::pq_schema(), and utility::sql_database::TransactionMode::standard.

Referenced by DatabaseIOBenchmark::setUp().

utility::sql_database::sessionOP basic::database::get_db_session ( string const &  db_name,
string const &  pq_schema 
)

Aquire a database session using the command line parameters For postgres databases, the pq_schema acts like a namespace in the database. Transaction type set to standard.

References utility::sql_database::database_mode_from_name(), get_db_session(), inout::dbms::mode(), option, options, and utility::sql_database::TransactionMode::standard.

sessionOP basic::database::get_db_session ( string const &  db_name,
TransactionMode::e  transaction_mode,
Size  chunk_size,
string const &  pq_schema 
)
utility::sql_database::sessionOP basic::database::get_db_session ( utility::sql_database::DatabaseMode::e  db_mode,
std::string const &  db_name,
std::string const &  pq_schema 
)
sessionOP basic::database::get_db_session ( DatabaseMode::e  db_mode,
TransactionMode::e  transaction_mode,
Size  chunk_size,
string const &  db_name,
string const &  pq_schema 
)
void basic::database::insert_or_ignore ( std::string  table_name,
std::vector< std::string >  column_names,
std::vector< std::string >  values,
utility::sql_database::sessionOP  db_session 
)
void basic::database::insert_or_ignore ( string  table_name,
std::vector< string >  column_names,
std::vector< string >  values,
sessionOP  db_session 
)
std::string basic::database::make_compound_statement ( std::string const &  table_name,
std::vector< std::string > const &  column_names,
platform::Size const &  row_count 
)
bool basic::database::open ( utility::io::izstream db_stream,
std::string const &  db_file,
bool  warn = true 
)

Open a database file on a provided stream.

Does a database file exist?

Open a database file on a provided stream

References utility::io::izstream::clear(), utility::io::izstream::close(), CREATE_EXCEPTION, full_name(), utility::io::izstream::good(), utility::io::izstream::open(), and TR.

Referenced by pyrosetta.toolbox.load_ligand::add_cid_to_database(), auto-DRRAFTER_setup::auto_setup_helices(), DRRAFTER_util::better_reorder_pdb(), DRRAFTER_util::cat_outfiles(), pyrosetta.toolbox.cleaning::cleanATOM(), options.KeepSameFile::close(), combine_pdbs::combine_pdbs(), compare_times::compare_times(), make_bindings_via_cmake::compile_sources(), ez_setup::download_file_insecure(), pyrosetta.toolbox.rcsb::download_from_web(), pyrosetta.toolbox.atom_pair_energy::dump_atom_pair_energy_table(), pyrosetta.toolbox.atom_pair_energy::dump_residue_pair_energies(), DRRAFTER_util::easy_cat(), erraser_wrapper::erraser(), erraser_wrapper::erraser_minimize(), erraser_wrapper::erraser_single_res(), build::execute(), erraser_single_res_analysis::extract_info(), DRRAFTER_util::extract_lowscore_decoys(), erraser_util::extract_pdb(), auto-DRRAFTER_setup_next_round::figure_out_next_round(), mutant_modeler::figure_out_WT_seq(), fmt::File::File(), finalize_models::finalize(), erraser_util::find_chi_angle(), erraser_single_res_analysis::find_chi_angle_std_pdb(), erraser_analysis::find_chi_angle_std_pdb(), build::generate_bindings(), build::generate_cmake_file(), build::generate_documentation(), pyrosetta.toolbox.generate_resfile::generate_resfile_from_pose(), demo.D050_Packer_task::generate_resfile_from_pose(), build::generate_rosetta_cmake_files(), build::generate_rosetta_external_cmake_files(), sphinx-doc-generator::generate_rst_sphinx_files(), DRRAFTER::get_coord_csts(), drrafter_rna::get_density_per_residue(), erraser_util::get_fasta(), mutant_modeler.MutantModeler::get_high_res_command_lines(), mutant_modeler.MutantModeler::get_med_res_command_lines(), setup::get_package_version(), auto-DRRAFTER_setup_next_round::get_results(), get_final_ddG_scores::get_scores(), DRRAFTER_util::get_sequences(), auto-DRRAFTER_setup_next_round::get_silent_file_subset(), mutant_modeler::get_ss(), auto-DRRAFTER_setup_next_round::get_top_ten_models_from_silent_files(), erraser_util::get_total_res(), erraser_util::grep(), ez_setup::has_curl(), ez_setup::has_powershell(), ez_setup::has_wget(), pyrosetta.distributed.viewer.core::init(), build::install_llvm_tool(), pyrosetta.toolbox.rcsb::load_fasta_from_rcsb(), compare_times::load_files(), pyrosetta.toolbox.load_ligand::load_from_pubchem(), pyrosetta.toolbox.rcsb::load_from_rcsb(), erraser_util::load_pdb_coord(), erraser_util::load_pdb_coord_old(), find_lowest_scoring_relaxed_struct::main(), get_lowest_scoring_relaxed_models::main(), general_RNP_setup_script::main(), get_final_ddG_scores::main(), best_ifaceE::main(), get_scores::main(), prune_atdiff_top5pct::main(), relax_starting_structure::main(), sidechain_cst_3::main(), self-test::main(), sphinx-doc-generator::main(), arls_impl::main(), make_bindings_via_cmake::make_all_includes(), make_bindings_via_cmake::make_bindings_code(), mutant_modeler.MutantModeler::make_high_res_subsets_and_cmd_lines(), submit_jobs::make_job_files_and_submit(), pyrosetta.io.silent_file_map::open_compressed(), utility::sql_database::session::open_mysql_session(), utility::sql_database::session::open_postgres_session(), utility::sql_database::session::open_sqlite3_session(), pyrosetta.toolbox.py_jobdistributor::output_scorefile(), DRRAFTER::parse_fasta(), DRRAFTER::parse_secstruct(), erraser_util::pdb2fasta(), erraser_util::pdb2rosetta(), erraser_util::pdb_slice(), DRRAFTER_util::pdbslice(), ObjexxFCL::process_file(), util::read_pdb(), DRRAFTER_util::read_pdb(), DRRAFTER_util::read_pdb_with_segid(), read_rama_map_file(), erraser_wrapper::rebuild_completed(), erraser_util::regularize_OP1_OP2(), erraser_util::regularize_pdb(), self-test::remover_absolute_paths(), DRRAFTER_util::renumber_pdb(), basic::sampling::orientations::QuaternionGridManager::request_by_name(), erraser_util::rosetta2phenix_merge_back(), erraser_util::rosetta2std_pdb(), self-test::run_test(), demo.D090_Ala_scan::scanning(), demo.D090_Ala_scan::scanning_analysis(), erraser_wrapper::seq_rebuild(), erraser_wrapper::seq_rebuild_new(), pyrosetta.tests.distributed.test_viewer.TestViewer::setUp(), DRRAFTER::setup_job(), drrafter_rna::setup_next_round(), erraser_util::sliced2orig_merge_back(), submit_jobs::submit_jobs(), erraser_util::subprocess_call(), erraser_util::subprocess_out(), erraser_wrapper::SWA_rebuild_erraser(), pyrosetta.tests.distributed.test_dask_worker.TestDaskArgs::test_worker_extra(), build::update_source_file(), drrafter_rna::write_command_file(), drrafter_rna::write_flags_extend_last_round(), DRRAFTER::write_flags_file(), arls_impl::write_if_not_exists(), and mutant_modeler.MutantModeler::write_mutfile().

utility::sql_database::sessionOP basic::database::parse_database_connection ( utility::tag::TagCOP  tag)

build database connection from options in a tag, this is useful make sure the fields for constructing a database connection are consistent across different tags.

References out::path::all(), utility::sql_database::TransactionMode::chunk, utility::sql_database::database_mode_from_name(), basic::options::OptionKeys::inout::dbms::database_name, basic::options::OptionKeys::inout::dbms::database_partition, inout::dbms::database_partition(), out::path::db(), utility::sql_database::DatabaseSessionManager::get_db_session(), utility::SingletonBase< DatabaseSessionManager >::get_instance(), basic::options::OptionKeys::cloud::host, basic::options::OptionKeys::inout::inout, basic::options::OptionKeys::dna::specificity::mode, utility::sql_database::DatabaseMode::mysql, utility::sql_database::name_from_database_mode(), utility::sql_database::name_from_transaction_mode(), utility::sql_database::TransactionMode::none, option, options, basic::options::OptionKeys::inout::dbms::password, basic::options::OptionKeys::in::path::path, inout::dbms::path(), basic::options::OptionKeys::cloud::port, utility::sql_database::DatabaseMode::postgres, basic::options::OptionKeys::inout::dbms::pq_schema, resolve_db_partition(), inout::dbms::separate_db_per_mpi_process(), utility::sql_database::DatabaseMode::sqlite3, utility::sql_database::TransactionMode::standard, TR, utility::sql_database::transaction_mode_from_name(), basic::options::OptionKeys::inout::dbms::user, utility_exit_with_message, and basic::Tracer::Warning.

Referenced by basic::database::DatabaseSessionOptions::parse_my_tag(), and basic::resource_manager::locator::DatabaseResourceLocator::parse_my_tag().

cppdb::statement basic::database::prepare_statement_no_catch ( std::string const &  statement_string,
utility::sql_database::sessionOP  db_session 
)

Do not catch the error - leave the catch for the code using it. Do not use this unless YOU are catching any erorrs (cppdb::error).

statement basic::database::prepare_statement_no_catch ( string const &  statement_string,
sessionOP  db_session 
)
platform::SSize basic::database::resolve_db_partition ( bool  partition_by_mpi_process,
platform::SSize  manual_partition 
)

Returns partition identifer from mpi rank if in partitioned database mode, or valid manual partition, otherwise -1.

References utility::mpi_rank().

Referenced by db_partition_from_options(), and parse_database_connection().

cppdb::statement basic::database::safely_prepare_statement ( std::string const &  statement_string,
utility::sql_database::sessionOP  db_session 
)
statement basic::database::safely_prepare_statement ( string const &  statement_string,
sessionOP  db_session 
)
cppdb::result basic::database::safely_read_from_database ( cppdb::statement &  statement)
result basic::database::safely_read_from_database ( statement &  statement)
void basic::database::safely_write_to_database ( cppdb::statement &  statement)
void basic::database::safely_write_to_database ( statement &  statement)
void basic::database::set_cache_size ( utility::sql_database::sessionOP  db_session,
platform::Size  cache_size 
)

set the number of 1kb pages to use for cache

void basic::database::set_cache_size ( sessionOP  db_session,
Size  cache_size 
)
bool basic::database::table_exists ( utility::sql_database::sessionOP  db_session,
std::string const &  table_name 
)
bool basic::database::table_exists ( sessionOP  db_session,
string const &  table_name 
)
void basic::database::write_schema_to_database ( std::string  schema,
utility::sql_database::sessionOP  db_session 
)
void basic::database::write_schema_to_database ( string  schema_str,
sessionOP  db_session 
)

Variable Documentation

basic::Tracer basic::database::TR("basic.io.database")
static

Referenced by find_cache_file(), full_name(), and open().

basic::Tracer basic::database::TR("basic.database.sql_utils")
static