Skip to content

Instantly share code, notes, and snippets.

@halit
Created August 18, 2012 12:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save halit/3386393 to your computer and use it in GitHub Desktop.
My Elixir Data Check
from model import *
from elixir import session
# kurulum yapiliyor
setup_all()
# olusuturuluyor
create_all()
# 1. kayit ekleniyor
Siteler(baslik="Halit Alptekin", site="http://www.halitalptekin.com", aciklama="Halit Alptekin Personal Blog")
# 2.kayit ekleniyor
Siteler(baslik="Google", site="http://www.google.com", aciklama="Arama Motoru")
# tum kayitlar ayni isimli degiskene ataniyor
kayitlar = Siteler.query.all()
# listenin tum elemanlarini yazdirmak icin for dongusu kuruluyor
for kayit in kayitlar:
print "-" * 20
print kayit.baslik
print kayit.site
print kayit.aciklama
print "-" * 20
# baska turlu bir filtreleme yapalim ve ilk elemani alalim
sorgu = Siteler.query.filter_by(baslik=u'Halit Alptekin')
kayit = sorgu.first()
# uygun sekilde ekrana basalim
print "%s (%s)" %(kayit.baslik, kayit.site)
# ayni kaydi silelim
kayit.delete()
session.commit()
@bugrati
Copy link

bugrati commented Mar 2, 2023

Jfdv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment