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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Marta Buda
May 20, 2015
Programming
0
190
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
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
200
AI & Enginnering
codelynx
0
120
CSC307 Lecture 03
javiergs
PRO
1
490
Apache Iceberg V3 and migration to V3
tomtanaka
0
160
組織で育むオブザーバビリティ
ryota_hnk
0
180
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
760
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
600
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.4k
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
120
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
180
Featured
See All Featured
Building the Perfect Custom Keyboard
takai
2
690
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
830
The agentic SEO stack - context over prompts
schlessera
0
640
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
52
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
120
The browser strikes back
jonoalderson
0
390
Everyday Curiosity
cassininazir
0
130
The Language of Interfaces
destraynor
162
26k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
280
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
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 㗂㘊㗌㗨㗆 ❤