Sha256: 9e77080ea7bac7b88f5e583da37ea2bfc1a74c45d91076760fc5c715c261071a

Contents?: true

Size: 926 Bytes

Versions: 9

Compression:

Stored size: 926 Bytes

Contents

require_relative "../../../test_helper"

module Unit
  module Connection
    module Query
      class TestTable < MiniTest::Test

        describe Clickhouse::Connection::Query::Table do
          it "generates a 'CREATE TABLE' statement" do
            table = Clickhouse::Connection::Query::Table.new("logs_test") do |t|
              t.uint8        :id
              t.float32      :price
              t.string       :name
              t.date         :date
              t.date_time    :time
              t.fixed_string :hex_id, 8
              t.engine       "MergeTree(date, 8192)"
            end

            sql = <<-SQL
CREATE TABLE logs_test (
  id     UInt8,
  price  Float32,
  name   String,
  date   Date,
  time   DateTime,
  hex_id FixedString(8)
)
ENGINE = MergeTree(date, 8192)
            SQL

            assert_equal sql.strip, table.to_sql.strip
          end
        end

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
ch-client-0.0.1 test/unit/connection/query/test_table.rb
clickhouse-0.1.10 test/unit/connection/query/test_table.rb
clickhouse-0.1.9 test/unit/connection/query/test_table.rb
clickhouse-0.1.8 test/unit/connection/query/test_table.rb
clickhouse-0.1.4 test/unit/connection/query/test_table.rb
clickhouse-0.1.3 test/unit/connection/query/test_table.rb
clickhouse-0.1.2 test/unit/connection/query/test_table.rb
clickhouse-0.1.1 test/unit/connection/query/test_table.rb
clickhouse-0.1.0 test/unit/connection/query/test_table.rb