--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Allows you to join multiple datasets/tables and have the result set split into component tables.
- !ruby/struct:SM::Flow::P 
  body: "This differs from the usual usage of join, which returns the result set as a single hash. For example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  # CREATE TABLE artists (id INTEGER, name TEXT);\n  # CREATE TABLE albums (id INTEGER, name TEXT, artist_id INTEGER);\n  DB[:artists].left_outer_join(:albums, :artist_id=&gt;:id).first\n  =&gt; {:id=&gt;albums.id, :name=&gt;albums.name, :artist_id=&gt;albums.artist_id}\n  DB[:artists].graph(:albums, :artist_id=&gt;:id).first\n  =&gt; {:artists=&gt;{:id=&gt;artists.id, :name=&gt;artists.name}, :albums=&gt;{:id=&gt;albums.id, :name=&gt;albums.name, :artist_id=&gt;albums.artist_id}}\n"
- !ruby/struct:SM::Flow::P 
  body: Using a join such as left_outer_join, the attribute names that are shared between the tables are combined in the single return hash. You can get around that by using .select with correct aliases for all of the columns, but it is simpler to use graph and have the result set split for you. In addition, graph respects any row_proc of the current dataset and the datasets you use with graph.
- !ruby/struct:SM::Flow::P 
  body: "If you are graphing a table and all columns for that table are nil, this indicates that no matching rows existed in the table, so graph will return nil instead of a hash with all nil values:"
- !ruby/struct:SM::Flow::VERB 
  body: "  # If the artist doesn't have any albums\n  DB[:artists].graph(:albums, :artist_id=&gt;:id).first\n  =&gt; {:artists=&gt;{:id=&gt;artists.id, :name=&gt;artists.name}, :albums=&gt;nil}\n"
- !ruby/struct:SM::Flow::P 
  body: "Arguments:"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: dataset - Can be a symbol (specifying a table), another dataset, or an object that responds to .dataset and return a symbol or a dataset
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: join_conditions - Any condition(s) allowed by join_table.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "options - A hash of graph options. The following options are currently used:"
  - !ruby/object:SM::Flow::LIST 
    contents: 
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: ":from_self_alias - The alias to use when the receiver is not a graphed dataset but it contains multiple FROM tables or a JOIN. In this case, the receiver is wrapped in a from_self before graphing, and this option determines the alias to use."
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: ":implicit_qualifier - The qualifier of implicit conditions, see #join_table."
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: ":join_type - The type of join to use (passed to join_table). Defaults to :left_outer."
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: ":select - An array of columns to select. When not used, selects all columns in the given dataset. When set to false, selects no columns and is like simply joining the tables, though graph keeps some metadata about join that makes it important to use graph instead of join."
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: ":table_alias - The alias to use for the table. If not specified, doesn't alias the table. You will get an error if the the alias (or table) name is used more than once."
    type: :BULLET
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: block - A block that is passed to join_table.
  type: :BULLET
full_name: Sequel::Dataset#graph
is_singleton: false
name: graph
params: (dataset, join_conditions = nil, options = {}, &block)
visibility: public
