Re-inventing query language Ruslan Zakirov < [email_address] > YAPC::EU Aug 2009
Queries
Queries select * from U where ...
Queries SQL
Queries S...? Query Language
SQL Simple?
SQL Small?
SQL Solid?
SQL What does S. stand for?
SQL (may be)  Stupid
SQL (may be)  Suckish
Jifty::DBI
Jifty::DBI ORM for Jifty
Jifty::DBI Records Collections
tisql
tisql ti-skull
tisql Query Language
tisql String-centric
Why string? Serialization
Why string? Typing
Why string? CLI
Why string? API
Syntax basics
Basics .foo = 'str' OR ( .baz > 10 )
Basics AND OR ( ) ' &quot;
Basics [!]=, [><]=? [NOT] LIKE IS [NOT] NULL
Jifty::DBI Relations
Jifty::DBI (relations) refers to Foo [by a_column]
Jifty::DBI (relations) refers_to FooCollection by a_column
Jifty::DBI (relations) Named
tisql relations .foo.bar.baz = 'x'
tisql relations .tags.used_by.id = $id
tisql relations .tag.value != 'foo'
Operation Modifiers
Operation Modifiers has has no
Operation Modifiers has [no] .foo.bar <=> .foo.bar.id is [not] null
Operation Modifiers has no .foo.bar = 'baz' <=> .foo.bar != 'baz'
Operation Modifiers has no .foo.bar != 'baz' has .foo.bar != 'baz'
No joins!?
[no] joins column foo => refers_to Foo
[no] joins …  by tisql '...'
[no] joins column attrs =>... by tisql &quot;attrs.model = 'User' AND attrs.record = .id&quot;
Combining things
Combining .members.first = 'John' AND .members.last = 'Doe'
Combining (John Doe) (John S., D. Doe)
Combining 1. Aliases
Combining FROM .members AS member WHERE member.first = 'John' AND member.last = 'Doe'
Combining 2. Placeholders
Combining column members => …  by tisql ' …  AND members.first = %f '
Combining has .members {first => 'John'} {last => 'Doe'}
Combining Idea! Any column!
Strings suck
Quote
API
API binding
API ->tisql('.foo = ?', «bar»);
API Q and C functions
API overload
API Q(...) | Q(...) Q(...) & Q(...)
Boring
Other Query Languages
Other QLs from:john (to:me OR cc:me)  asshole
Other QLs Parse
Other QLs Parse ::BooleanLogic
Other QLs callbacks based
Other QLs default struct
Other QLs processing
Cool things
cool things joins bundling
cool things (tag:foo OR tag:bar) tag:zoo
cool things joins merging
cool things .a.b.c.col = 'x' AND .a.b.c.d.col = 'y'
cool things subset extraction
cool things subject:x !tag:foo tag:bar
cool things subject:x
Where?
Where <ul><li>Parse::BooleanLogic — CPAN
tisql — Jifty::DBI's branch </li><ul><li>http://svn.jifty.org/svn/jifty.org/Jifty-DBI/branches/tisql/ </li></ul></ul>
the:end
Questions?
Speak slow and loud
Upcoming SlideShare
Loading in...5
×

Re Inventing Query Language

409

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
409
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Re Inventing Query Language

  1. 1. Re-inventing query language Ruslan Zakirov < [email_address] > YAPC::EU Aug 2009
  2. 2. Queries
  3. 3. Queries select * from U where ...
  4. 4. Queries SQL
  5. 5. Queries S...? Query Language
  6. 6. SQL Simple?
  7. 7. SQL Small?
  8. 8. SQL Solid?
  9. 9. SQL What does S. stand for?
  10. 10. SQL (may be) Stupid
  11. 11. SQL (may be) Suckish
  12. 12. Jifty::DBI
  13. 13. Jifty::DBI ORM for Jifty
  14. 14. Jifty::DBI Records Collections
  15. 15. tisql
  16. 16. tisql ti-skull
  17. 17. tisql Query Language
  18. 18. tisql String-centric
  19. 19. Why string? Serialization
  20. 20. Why string? Typing
  21. 21. Why string? CLI
  22. 22. Why string? API
  23. 23. Syntax basics
  24. 24. Basics .foo = 'str' OR ( .baz > 10 )
  25. 25. Basics AND OR ( ) ' &quot;
  26. 26. Basics [!]=, [><]=? [NOT] LIKE IS [NOT] NULL
  27. 27. Jifty::DBI Relations
  28. 28. Jifty::DBI (relations) refers to Foo [by a_column]
  29. 29. Jifty::DBI (relations) refers_to FooCollection by a_column
  30. 30. Jifty::DBI (relations) Named
  31. 31. tisql relations .foo.bar.baz = 'x'
  32. 32. tisql relations .tags.used_by.id = $id
  33. 33. tisql relations .tag.value != 'foo'
  34. 34. Operation Modifiers
  35. 35. Operation Modifiers has has no
  36. 36. Operation Modifiers has [no] .foo.bar <=> .foo.bar.id is [not] null
  37. 37. Operation Modifiers has no .foo.bar = 'baz' <=> .foo.bar != 'baz'
  38. 38. Operation Modifiers has no .foo.bar != 'baz' has .foo.bar != 'baz'
  39. 39. No joins!?
  40. 40. [no] joins column foo => refers_to Foo
  41. 41. [no] joins … by tisql '...'
  42. 42. [no] joins column attrs =>... by tisql &quot;attrs.model = 'User' AND attrs.record = .id&quot;
  43. 43. Combining things
  44. 44. Combining .members.first = 'John' AND .members.last = 'Doe'
  45. 45. Combining (John Doe) (John S., D. Doe)
  46. 46. Combining 1. Aliases
  47. 47. Combining FROM .members AS member WHERE member.first = 'John' AND member.last = 'Doe'
  48. 48. Combining 2. Placeholders
  49. 49. Combining column members => … by tisql ' … AND members.first = %f '
  50. 50. Combining has .members {first => 'John'} {last => 'Doe'}
  51. 51. Combining Idea! Any column!
  52. 52. Strings suck
  53. 53. Quote
  54. 54. API
  55. 55. API binding
  56. 56. API ->tisql('.foo = ?', «bar»);
  57. 57. API Q and C functions
  58. 58. API overload
  59. 59. API Q(...) | Q(...) Q(...) & Q(...)
  60. 60. Boring
  61. 61. Other Query Languages
  62. 62. Other QLs from:john (to:me OR cc:me) asshole
  63. 63. Other QLs Parse
  64. 64. Other QLs Parse ::BooleanLogic
  65. 65. Other QLs callbacks based
  66. 66. Other QLs default struct
  67. 67. Other QLs processing
  68. 68. Cool things
  69. 69. cool things joins bundling
  70. 70. cool things (tag:foo OR tag:bar) tag:zoo
  71. 71. cool things joins merging
  72. 72. cool things .a.b.c.col = 'x' AND .a.b.c.d.col = 'y'
  73. 73. cool things subset extraction
  74. 74. cool things subject:x !tag:foo tag:bar
  75. 75. cool things subject:x
  76. 76. Where?
  77. 77. Where <ul><li>Parse::BooleanLogic — CPAN
  78. 78. tisql — Jifty::DBI's branch </li><ul><li>http://svn.jifty.org/svn/jifty.org/Jifty-DBI/branches/tisql/ </li></ul></ul>
  79. 79. the:end
  80. 80. Questions?
  81. 81. Speak slow and loud
  82. 82. Not thaaaat slow
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×