Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Małe co nieco Sequela
Search
Marta Buda
May 20, 2015
Programming
0
200
Małe co nieco Sequela
TRUG#37 presentation about one of Ruby gems - Sequel. Slides are in polish.
Marta Buda
May 20, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
Pythonデータ分析コトハジメinFukuoka
kanan
0
100
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.3k
それはエンジニアリングの糧である:AI開発のためにAIのOSSを開発する現場より / It serves as fuel for engineering: insights from the field of developing open-source AI for AI development.
nrslib
1
510
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
180
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
390
へんな働き方
yusukebe
5
2.8k
Reactive ❤️ Loom: A Forbidden Love Story
franz1981
2
150
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
120
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1.1k
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
1.1k
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
180
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
470
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
160
The Spectacular Lies of Maps
axbom
PRO
1
640
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
180
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
92
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
240
Evolving SEO for Evolving Search Engines
ryanjones
0
170
Music & Morning Musume
bryan
47
7.1k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
150
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
160
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
320
Tell your own story through comics
letsgokoyo
1
870
Transcript
Małe co nieco Sequela .BSUB#VEB 536(
Sequel? • Narzędzie do korzystania z relacyjnych baz danych. •
Obsługuje: ADO, Amalgalite, CUBRID, DataObjects, IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle, PostgreSQL, SQLAnywhere, SQLite3, Swift oraz TinyTDS. • https://github.com/jeremyevans/sequel • http://sequel.jeremyevans.net
Historia • 1. wersja: 4. marca 2007. • Do tej
pory 168 wydań. • Obecnie 4.22.0 najnowsza. • Na początku każdego miesiąca uaktualnienia. • TL;DR Rozwija się regularnie od ponad 8 lat.
Od czego zacząć? • Od połączenia z bazą danych. •
Można nawiązać więcej niż jedno połączenie. • Obiekt Sequel::Database • Więcej na: http://sequel.jeremyevans.net/rdoc/files/ doc/opening_databases_rdoc.html
Migracje • Podobne do ActiveRecord, zmieniają schemat bazy danych. Dodawanie
tabel, zmiany kolumn, indeksy, itd. itp. • Sequel Migrator odpalany w terminalu: sequel -m path/to/migrations postgres://host/database • Rollback do początku: sequel -m path/to/migrations -M 0 postgres://host/database
Sequel::Dataset • Obiekt reprezentujący zapytania SQL do bazy. • Może
zawierać całą tabele DB[:table_name] • lub wybrany zbiór rekordów DB.from(“table_name”).where(:column => “value”) .order(:another_column).all
Sequel::Model class Example < Sequel::Model(FIRST_DB[:examples]) end class Other < Sequel::Model(SECOND_DB[:others])
end • Model powiązany ze swoim Dataset. • Walidacja: def validate super errors.add(:column, ‘cannot be empty’) if !column || column.empty? end
Pluginy • Rozszerzają możliwości Sequela. • Przykłady: - validation_helpers -
timestamps • Sequel::Model.plugin :timestamps
Testy, testy • DatabaseCleaner: DatabaseCleaner[:sequel, {:connection => Sequel.connect(uri)}] • Sequel.mock
Sequel.mock(:fetch => [ {:column => “value”, :another => “other” }, { :column => “blabla”, :another => “other” } ]) }
Pytania? Uwagi? Spostrzeżenia?
Dziękuję Thank you 㗂㘊㗌㗨㗆 ❤