I'm getting started using Sequel and I am running into a strange syntax
error that I can't figure out how to solve.
require 'sequel'
require 'logger'
client = Sequel.sqlite loggers: [Logger.new($stdout)]
table_name = 'my_table_name'
client.create_table?(table_name) do
primary_key :id
end
table = client[table_name]
puts "Records in table: #{table.count}"
puts "Inserting record into table"
table.insert
When I run the code, I get the following output:
I, [2015-02-04T00:08:35.563069 #19855] INFO -- : (0.000104s) PRAGMA
foreign_keys = 1
I, [2015-02-04T00:08:35.563157 #19855] INFO -- : (0.000016s) PRAGMA
case_sensitive_like = 1
I, [2015-02-04T00:08:35.563268 #19855] INFO -- : (0.000072s) SELECT
sqlite_version()
I, [2015-02-04T00:08:35.563601 #19855] INFO -- : (0.000180s) CREATE TABLE
IF NOT EXISTS `my_table_name` (`id` integer NOT NULL PRIMARY KEY )
I, [2015-02-04T00:08:35.563854 #19855] INFO -- : (0.000041s) SELECT
count(*) AS 'count' FROM (my_table_name) AS 't1' LIMIT 1
Records in table: 0
Writing to table
E, [2015-02-04T00:08:35.563948 #19855] ERROR -- : SQLite3::SQLException:
near "my_table_name": syntax error: my_table_name
What am I doing wrong?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.