Sequel::Model Plugins for v5.69.0
Sequel::Model has a standardized and very flexible plugin architecture, see the RDoc. Here is a list of plugins that members of the Sequel community have developed.
Plugins that ship with Sequel
- association_dependencies Allows easy deleting, destroying, or nullifying associated objects when destroying a model object.
- association_lazy_eager_option Support :eager option when calling association method, for per-call eager loading when association is not cached.
- association_multi_add_remove Allows adding/removing multiple associated objects in a single method call.
- association_pks Adds the association_pks and association_pks= to *_to_many associations.
- association_proxies Changes the *_to_many association method to return a proxy instead of an array of objects.
- auto_restrict_eager_graph Automatically disallow the use of eager_graph for associations with blocks but without :graph_* conditions.
- concurrent_eager_loading Allows you to concurrently eagerly load multiple associations using the async_thread_pool Database extension.
- dataset_associations Adds association methods to datasets that return datasets of associated objects.
- delay_add_association Delay add_association calls on new objects until after after the object is saved.
- eager_each Makes each on an eagerly loaded dataset do eager loading.
- eager_graph_eager Allows chaining eager loads to associations loaded by eager_graph.
- forbid_lazy_load Forbids lazy loading of associations in cases where they could cause N+1 query issues.
- instance_specific_default Find associations that would benefit from having the :instance_specific option specified.
- many_through_many Allows you to create an association through multiple join tables.
- nested_attributes Allows you to modified associated objects directly through a model object, similar to ActiveRecord's Nested Attributes.
- pg_array_associations Adds associations types to handle the case where foreign keys are stored in a PostgreSQL array in one of the tables.
- rcte_tree Supports retrieving all ancestors and descendants for tree structured data using recursive common table expressions.
- tactical_eager_loading Allows you to eagerly load an association for all objects retreived from the same dataset when calling the association method on any of the objects in the dataset.
- tree Allows you to treat model objects as being part of a tree, finding ancestors, descendants, siblings, and tree roots.
- unused_associations Determines which associations and association methods you can skip defining to save on memory.
- validate_associated Supports validating associated objects at the same time as the current object.
- accessed_columns Records which columns have been accessed for a given model instance.
- blacklist_security Adds blacklist-based model mass-assignment protection.
- boolean_readers Adds attribute? methods for all boolean columns.
- column_conflicts Automatically handles column names that conflict with Ruby/Sequel method names.
- column_encryption Encrypt column values stored in the database.
- dirty Allows you get get initial values of columns after changing the values.
- defaults_setter Get default values for new models before saving.
- enum Allows for treating a column as a enum.
- force_encoding Forces the all model column string values to a given encoding.
- input_transformer Automatically transform input to model column setters.
- lazy_attributes Allows you to set some attributes that should not be loaded by default, but only loaded when an object requests them.
- modification_detection Automatically detect in-place changes to column values.
- split_values Splits noncolumn entries from values hash into separate hash.
- string_stripper Strips strings assigned to model attributes.
- uuid Automatically sets UUID attribute when creating model objects.
- whitelist_security Adds whitelist-based model mass-assignment protection.
- caching Supports caching primary key lookups of model objects to any object that supports the Ruby-Memcache API.
- static_cache Caches all model instances, improving performance for static models.
- static_cache_cache Support caching rows for static_cache models to a file to avoid database queries during model initialization.
- after_initialize Adds an after_initialize hook to model objects, called for both new objects and those loaded from the database.
- hook_class_methods Adds backwards compatiblity for the legacy class-level hook methods (e.g. before_save :do_something).
- instance_hooks Allows you to add hooks to specific model instances.
- class_table_inheritance Supports inheritance in the database by using a single database table for each class in a class hierarchy.
- single_table_inheritance Supports inheritance in the database by using a single table for all classes in a class hierarchy.
- prepared_statements Makes models use prepared statements for deletes, inserts, updates, and lookups by primary key.
- prepared_statements_safe Makes use of prepared_statements plugin more safe by setting explicit defaults for model columns when inserting and saving whole rows instead of changed columns.
- columns_updated Makes columns hash used for updates available in after_update and after_save hooks.
- insert_conflict Allows handling unique constraint conflicts when saving new model instances on PostgreSQL 9.5+ and SQLite 3.24.0+.
- instance_filters Allows you to add per instance filters that are used when updating or destroying the instance.
- mssql_optimistic_locking Uses a timestamp/rowversion column on Microsoft SQL Server to prevent concurrent updates overwriting changes.
- optimistic_locking Adds a database-independent locking mechanism to models to prevent concurrent updates overwriting changes.
- sharding Additional model support for Sequel's sharding support.
- skip_create_refresh Allows you to skip the refresh when saving new model objects.
- skip_saving_columns Allows for marking columns to skip when saving model objects, and skips the saving of generated columns by default.
- timestamps Creates hooks for automatically setting create and update timestamps.
- touch Allows easily updating timestamps via Model#touch, as well as touching associations when model instances are updated or destroyed.
- unlimited_update Works around MySQL warnings when using replication due to LIMIT clause use when updating model instances.
- update_or_create Adds helper methods for updating an object if it exists, or creating such an object if it does not.
- update_primary_key Allows you to safely update the primary key of a model object.
- update_refresh Refreshes a model object when updating it.
- column_select Selects explicitly qualified columns (table.column1, table.column2, ...) instead of just * for model datasets.
- insert_returning_select Automatically sets RETURNING clause for INSERT queries for models that use an explicit column selection.
- table_select Selects table.* instead of just * for model datasets.
- composition Supports defining getters/setters for objects with data backed by the model's columns.
- csv_serializer Allows you to serialize/deserialize model objects to/from CSV.
- json_serializer Allows you to serialize/deserialize model objects to/from JSON.
- serialization Supports serializing column values and storing them as either marshal, yaml, or json in the database.
- serialization_modification_detection Allows you to detect changes to serialized columns.
- xml_serializer Allows you to serialize/deserialize model objects to/from XML.
- boolean_subsets Automatically creates a subset method for each boolean column.
- def_dataset_method Adds Model.def_dataset_method and Model.subset for backwards compatibility.
- inverted_subsets Creates an additional method for each subset, that inverts the subset's conditions.
- subset_conditions Creates an additional method for each subset, returning the filter conditions used for the subset.
- auto_validations Automatically add presence/not_null, max length, type, and unique validations based on the model's schema.
_validations_presence_message Use more specific constraint_validations error message instead of generic auto_validations in certain cases.
- constraint_validations Setup automatic validations for constraints added via the constraint_validations extension.
- empty_failure_backtraces Uses empty backtraces for ValidationFailed and HookFailed exceptions, for much better performance on JRuby.
- error_splitter Splits multi-column errors entries into separate errors, one per column.
- pg_auto_constraint_validations Automatically convert constraint violations during INSERT/UPDATE on PostgreSQL to validation failures.
- throw_failures Throws ValidationFailed and HookFailed exceptions instead of raising them, if a matching catch block is used.
- validation_class_methods Adds backwards compatibility for the legacy class-level validation methods (e.g. validates_presence_of :column).
- validation_contexts Allow specifying a context to use during validations.
- validation_helpers The preferred default validations plugin, which uses instance-level methods.
- validation_helpers_generic_type_messages Creates more useful default type validation failure messages when using validation_helpers.
- active_model Makes Sequel::Model objects compliant to the ActiveModel::Lint specs, so they should work correctly in Rails 3+.
- async_thread_pool Adds better support for model classes to use the async_thread_pool Database extension.
- finder Adds Model.finder and Model.prepared_finder methods for defining optimized lookup methods.
- list Allows you to treat model objects as being part of a list, so you can move them up/down and get next/previous entries.
- pg_row Allows Sequel::Model classes to implement PostgreSQL row-valued/composite types.
- primary_key_lookup_check_values Typecasts and checks values in allowed range during lookups by primary key.
- require_valid_schema Requires that model classes selecting from simple tables have valid schema.
- singular_table_names Makes Sequel default to not pluralizing table names.
- sql_comments Supports automatically adding comments to queries to show which class, instance, dataset, or association method triggered the query.
- subclasses Allows easy access all model subclasses and descendent classes, without using ObjectSpace.
- typecast_on_load Fixes bad database typecasting when loading model objects.
- forme HTML forms library for ruby that integrates with Sequel::Model for easy form creation.
- sequel-active_record Provides ActiveRecord compatibility to ease transitions to Sequel.
- sequel_bulk_attributes Provides bulk assignment functionality for one_to_many associations.
- sequel-bit_fields Allows treating an integer column as a bitfield of many boolean settings.
- sequel-combine Provides functionality of composing with childrens, parents or any object where exists any relationship. Now it is possible in one query.
- sequel_container Contained documents (i.e. attachments) for models.
- sequel_crushyform Builds forms for you
- sequel-elasticsearch Sync Sequel models to Elasticsearch.
enum_values(field_name)method for model class and optional optional instance predicate methods like
- sequel-generate-slug Auto-generates URL-friendly slugs for Sequel models. Uses title column, saves slug in slug column. Supports multi-language slugs, updates with title change.
- sequel-hash_id Obscure your primary keys with a hashid.
- sequel_nanoid Obscure your primary keys using nanoID.
- sequel_mappable Provides geocoding functionality to model and dataset.
- sequel_nested_set Nested set implementation, ported from the Awesome Nested Set Active Record plugin.
- sequel-nonsequential_id Automatically generate non-sequential (pseudo-random) IDs for Sequel Models.
- sequel_notnaughty Port of the NotNaughty validation framework.
- sequel_paperclip Provides attachment functionality for models, including post processing (thumbnail generation, etc.).
- sequel-pg_advisory_lock Allows you to use PostgreSQL advisory locks for application-level mutexes.
- sequel_pretty_print Adds Ruby PrettyPrint support to models (works in Pry console).
- sequel_polymorphic Lets you easily create polymorphic associations.
- sequel_proc_error_handling Lets you add procs that automatically rescue and fix model errors.
- sequel_secure_password Adds bcrypt authentication and password hashing to models.
- sequel_sexy_validations Provides sexy validations (like those in rails 3) for models.
- sequel_simple_callbacks Enables ActiveRecord-compatible class-level before and after filter declarations for models with support for conditional execution.
- sequel_sluggable Easy slug behaviour for any model.
- sequel-table_inheritance Combines the functionality of the single table inheritance and class table inheritance plugins.
- sequel_taggable Allows easily adding tags to any model.
- sequel-through Adds support for :through associations between models.
- sequel_validation_helpers_block Allows easy determination of which validation rules apply to a given column, at the expense of increased verbosity.
Sequel Extensions are modifications or additions to Sequel that affect either Sequel::Database objects (database extensions), Sequel::Dataset objects (dataset extensions), or the general ruby environment (global extensions).
Database extensions that ship with Sequel
Database extensions can be loaded into a single Sequel::Database object via Sequel::Database#extension, or to all databases by using Sequel::Database.extension.
- arbitrary_servers Adds ability to connection to arbitrary servers (instead of just preconfigured ones) in the sharding support.
- async_thread_pool Adds support for running queries asynchronously using a thread pool.
- caller_logging Include caller information when logging queries.
- connection_expiration Automatically removes connections from the pool after they have been open longer than a timeout.
- connection_validator Automatically validates connections on pool checkout and handles disconnections transparently.
- constant_sql_override Override generated SQL for Sequel constants with configurable strings.
- constraint_validations Creates database constraints when creating/altering tables, with metadata for automatic model validations via the constraint_validations plugin.
- error_sql Makes DatabaseError#sql return the SQL query that caused the underlying exception.
- identifier_mangling Support modification for the default identifier mangling for the database.
- index_caching Speeds up loading index information by saving/loading database index metadata to a file.
- integer64 Treats the Integer class as a 64-bit integer instead of a 32-bit integer when used as a generic database type.
- looser_typecasting Uses .to_f and .to_i instead of Kernel.Float and Kernel.Integer when typecasting floats and integers.
- pg_array Adds support for PostgreSQL arrays.
- pg_auto_parameterize Automatically parameterizes queries when using the postgres adapter with the pg driver.
- pg_enum Adds support for PostgreSQL enums.
- pg_extended_date_support Adds support for PostgreSQL infinite and BC date/timestamp support.
- pg_extended_integer_support Adds support for handling Ruby integers outside PostgreSQL bigint range.
- pg_hstore Adds support for the PostgreSQL hstore type.
- pg_inet Adds support for the PostgreSQL inet and cidr types.
- pg_interval Adds support for the PostgreSQL interval type.
- pg_json Adds support for the PostgreSQL json type.
- pg_loose_count Adds Database#loose_count for fast approximate counts of whole tables on PostgreSQL.
- pg_multirange Adds support for PostgreSQL multirange types.
- pg_range Adds support for PostgreSQL range types.
- pg_row Adds support for PostgreSQL row-valued/composite types.
- pg_static_cache_updater Listens for changes to underlying tables in order to automatically update models using the static_cache plugin.
- pg_timestamptz Uses timestamptz (timestamp with time zone) as the generic timestamp type used for Time and DateTime classes.
- run_transaction_hooks Support running after_commit and after_rollback transaction hooks before transaction commit/rollback, designed for transactional testing.
- schema_caching Speeds up loading a large number of models by caching database schema and loading it from a file.
- schema_dumper Adds Database#dump_schema_migration and related methods for dumping the schema of the database as a migration that can be restored on other databases.
- server_block Adds Database#with_server method that makes access inside the passed block use the specified shard by default.
- server_logging Include server/shard information when logging queries.
- sql_comments Adds Database#with_comments method, for automatically using comments for queries exceuted inside a block.
- sql_log_normalizer Normalizes SQL before logging, helpful for analytics and sensitive data.
Dataset extensions that ship with Sequel
Dataset extensions can be loaded into a single Sequel::Database object via Sequel::Dataset#extension, or to all datasets for a given database via Sequel::Database#extension, or all datasets for all databases by using Sequel::Database.extension.
- any_not_empty Make Dataset#any? without block mean !empty?.
- auto_literal_strings Automatically treats string arguments passed to filter methods as literal SQL.
- columns_introspection Attemps to skip database queries by introspecting the selected columns if possible.
- current_datetime_timestamp Creates current Time/DateTime objects that are literalized as CURRENT_TIMESTAMP.
- dataset_source_alias Automatically aliases datasets to their source instead of using t1, t2, etc.
- date_arithmetic Allows for database-independent date calculations (adding/subtracting an interval to/from a date/timestamp).
- duplicate_columns_handler Allows you to raise or warn if the dataset returns multiple columns with the same name when returning the results.
- empty_array_consider_nulls Makes Sequel's handling of IN/NOT IN with an empty array use a NULL expression for NULL column values.
- exclude_or_null Add Dataset#exclude_or_null for only including rows where condition is false or NULL.
- graph_each Makes Dataset#each split returned results by table when using Dataset#graph.
- implicit_subquery Makes dataset methods that return datasets with modified SQL use a subquery implicitly if the current dataset uses raw SQL.
- is_distinct_from Allows for using or emulating the IS DISTINCT FROM operator.
- null_dataset Adds Dataset#nullify to get a dataset that will never issue a query.
- mssql_emulate_lateral_with_apply Emulates LATERAL queries using CROSS/OUTER APPLY on Microsoft SQL Server.
- pagination Adds Dataset#paginate for easier pagination of datasets.
- pretty_table Adds Dataset#print for printing a dataset as a simple plain-text table.
- query Adds Dataset#query for a different interface to creating queries that doesn't use method chaining.
- round_timestamps Automatically round timestamp values to database supported precision before literalizing them.
- set_literalizer Literalize Set instances in datasets similar to Array instances.
- select_remove Adds Dataset#select_remove to remove selected columns from a dataset.
- sequel_4_dataset_methods Adds #and, #exclude_where, #interval, and #range dataset methods.
- split_array_nil Splits nils out of IN/NOT IN arrays into separate OR IS NULL or AND IS NOT NULL clauses.
- sql_comments Adds Dataset#comment method, for setting an SQL comment in the queries created by the dataset.
- string_agg Adds generic database support for aggregate string concatentation.
- synchronize_sql Checks out a connection while generating SQL strings, improving performance in some cases.
- to_dot Adds Dataset#to_dot method, which returns a string suitable for processing by graphviz's dot program to get a visualization of the dataset's abstract syntax tree.
Global extensions that ship with Sequel
Global extensions can affect other parts of Sequel or the general ruby environment, and are loaded with Sequel.extension.
- blank Adds blank? instance methods to all objects.
- core_extensions Extends the Array, Hash, String, and Symbol classes with methods that return Sequel expression objects.
- core_refinements Adds refinement versions of Sequel's core extensions.
- eval_inspect Makes inspect on Sequel's expression objects attempt to return a string suitable for eval.
- escaped_like Support creation of LIKE expressions with placeholders in the pattern without access to a dataset.
- date_parse_input_handler Allows for custom handling of input strings to the date parsing methods.
- datetime_parse_to_time Uses DateTime.parse.to_time to parse timestamp strings without offset information where such timestamps are assumed to be in UTC.
- fiber_concurrency Uses Fiber.current instead of Thread.current as the key for checking out connections.
- inflector Adds instance-level inflection methods to String.
- migration Adds Migration and Migrator classes for easily migrating the database schema forward or reverting to a previous version.
- named_timezones Allows you to use named timezones instead of just :local and :utc (requires TZInfo).
- pg_array_ops Adds DSL support for calling PostgreSQL array operators and functions.
- pg_hstore_ops Adds DSL support for calling PostgreSQL hstore operators and functions.
- pg_inet_ops Adds DSL support for calling PostgreSQL inet/cidr operators and functions.
- pg_json_ops Adds DSL support for calling PostgreSQL json operators and functions.
- pg_range_ops Adds DSL support for calling PostgreSQL range and multirange operators and functions.
- pg_row_ops Adds DSL support for dealing with PostgreSQL row-valued/composite types.
- s Adds Sequel::S module with #S private method for easily calling Sequel.expr, including use as a refinement.
- sql_expr Adds sql_expr method to all objects, allowing easy use of Sequel's DSL.
- sqlite_json_ops Adds DSL support for calling SQLite json operators and functions.
- string_date_time Adds instance methods to String for converting the string into a Date/Time/DateTime.
- symbol_aref Extends Symbol# to create a qualified identifier if given a symbol, identifier, or qualified identifier.
- symbol_aref_refinement Adds refinement version of symbol_aref extension.
- symbol_as Adds Symbol#as to create aliased expressions.
- symbol_as_refinement Adds refinement version of symbol_as extension.
- thread_local_timezones Allows for per-thread overrides of the global timezone settings.
- virtual_row_method_block Supports passing blocks to virtual row method for terser SQL function creation.
- annotate-sequel Generates model annotations for Sequel models.
- fixture_dependencies YAML fixture loader that handles dependencies/associated objects, respecting foreign key constraints.
- i18n_backend_sequel Allows Sequel to be a backend for i18n translations.
- miguel Allows management of database schemas, including auto generation/application of migrations.
- rails_sequel Rails 2 plugin that allows you to use Sequel instead of ActiveRecord.
- refile-sequel Provides an extension for using Refile with Sequel.
- rspec_sequel_matchers RSpec matchers for Sequel validations, associations, and columns.
- sequel-activerecord_connection Allows Sequel to use ActiveRecord's connection for database interaction.
- sequel-annotate Generates model annotations for Sequel models, including constraint and trigger information on PostgreSQL.
- sequel_extjs Generates JSON from datasets that is consumable by the ExtJS JsonStore.
- sequel-location Easy setup and syntax for doing geolocation search on PostgreSQL.
- sequel_pg Faster SELECTs when using Sequel with pg.
- sequel-pg_advisory_locking Adds PostreSQL advisory locking support.
- sequel-pg-comment Document your schema by setting comments on all your PgSQL objects.
- sequel_plus Collection of sequel extensions.
- sequel_postgresql_triggers Database enforced timestamps, immutable columns, and counter/sum caches.
- sequel-rails Rails 3 plugin that allows you to use Sequel instead of ActiveRecord.
- sequel_rails3 Another Rails 3 plugin that allows you to use Sequel instead of ActiveRecord.
- sequel-force-hooks Have after_commit/after_rollback hooks apply to current savepoint instead of transaction.
- sequel-seed A Sequel extension to make seeds/fixtures manageable like migrations.
- sequel_tools Tools to help with managing database operations with Sequel through Rake tasks.
- sequel_vectorized Allows Sequel::Dataset to be exported as an Hash of Arrays and NArrays.
Adapters allow Sequel to communicate with databases. Sequel ships with many adapters, but here are links to external adapters:
- fusiontables Fusion Tables adapter using ft driver
- hive Hadoop Hive adapter using rbhive driver
- impala Impala adapter, including jdbc/hive2 adapter
- jdbc-crate JDBC subadapter for Crate database
- jdbc-hxtt JDBC subadapter for MS Access databases
- openedge ODBC and JDBC subadapters for OpenEdge database
- snowflake ODBC subadapter for Snowflake databases
- vertica Vertica adapter using vertica driver
Submitting Your Plugin/Extension/Adapter
If you have created a Sequel plugin/extension/adapter and would like to list it here, please submit a request to code AT jeremyevans DOT net, or send a pull request via GitHub.