Class: ActiveRecord::ConnectionAdapters::BigQueryAdapter
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- ActiveRecord::ConnectionAdapters::BigQueryAdapter
- Includes:
- BigQueryAdapter::DatabaseStatements, BigQueryAdapter::Quoting, BigQueryAdapter::SchemaStatements
- Defined in:
- lib/active_record/connection_adapters/big_query_adapter.rb
Overview
Adapter in the active record namespace
Defined Under Namespace
Classes: BindSubstitution
Constant Summary collapse
- ADAPTER_NAME =
'BigQuery'.freeze
- ERR_DUPLICATE_KEY_VALUE =
23_505
- ERR_QUERY_TIMED_OUT =
57_014
- ERR_QUERY_TIMED_OUT_MESSAGE =
/Query has timed out/
Constants included from BigQueryAdapter::DatabaseStatements
BigQueryAdapter::DatabaseStatements::NATIVE_DATABASE_TYPES
Instance Attribute Summary collapse
-
#database_metadata ⇒ Object
readonly
The object that stores the information that is fetched from the DBMS when a connection is first established.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Checks whether the connection to the database is still active.
-
#adapter_name ⇒ Object
Returns the human-readable name of the adapter.
-
#disconnect! ⇒ Object
Disconnects from the database if already connected.
-
#initialize(connection, logger, config, database_metadata) ⇒ BigQueryAdapter
constructor
A new instance of BigQueryAdapter.
-
#reconnect! ⇒ Object
(also: #reset!)
Disconnects from the database if already connected, and establishes a new connection with the database.
Methods included from BigQueryAdapter::SchemaStatements
#columns, #current_database, #foreign_keys, #index_name, #indexes, #primary_key, #tables, #views
Methods included from BigQueryAdapter::Quoting
#quote_string, #quote_table_name
Methods included from BigQueryAdapter::DatabaseStatements
#exec_query, #execute, #native_database_types, #supports_ddl_transactions, #valid_type?
Constructor Details
#initialize(connection, logger, config, database_metadata) ⇒ BigQueryAdapter
Returns a new instance of BigQueryAdapter.
48 49 50 51 |
# File 'lib/active_record/connection_adapters/big_query_adapter.rb', line 48 def initialize(connection, logger, config, ) super(connection, logger, config) @database_metadata = end |
Instance Attribute Details
#database_metadata ⇒ Object (readonly)
The object that stores the information that is fetched from the DBMS when a connection is first established.
46 47 48 |
# File 'lib/active_record/connection_adapters/big_query_adapter.rb', line 46 def @database_metadata end |
Instance Method Details
#active? ⇒ Boolean
Checks whether the connection to the database is still active. This includes checking whether the database is actually capable of responding, i.e. whether the connection isn’t stale.
63 64 65 |
# File 'lib/active_record/connection_adapters/big_query_adapter.rb', line 63 def active? @connection.run('SELECT TRUE AS active') end |
#adapter_name ⇒ Object
Returns the human-readable name of the adapter.
54 55 56 |
# File 'lib/active_record/connection_adapters/big_query_adapter.rb', line 54 def adapter_name ADAPTER_NAME end |
#disconnect! ⇒ Object
Disconnects from the database if already connected. Otherwise, this method does nothing.
78 79 80 |
# File 'lib/active_record/connection_adapters/big_query_adapter.rb', line 78 def disconnect! false end |
#reconnect! ⇒ Object Also known as: reset!
Disconnects from the database if already connected, and establishes a new connection with the database.
69 70 71 72 73 |
# File 'lib/active_record/connection_adapters/big_query_adapter.rb', line 69 def reconnect! disconnect! @connection = Base.big_query_connection(@config) super end |