Vino

Software screenshot:
Vino
Podrobnosti Software:
Verze: 0.1.0
Datum uploadu: 20 Feb 15
Vývojka: Hsiaoming Yang
Licence: Volný
Popularita: 2

Rating: nan/5 (Total Votes: 0)

Vino není ORM. Ano, to je pravda, že to není ORM.
Začínáme
Rychlý pohled s Vino:
# Nastavení
# Db = Vino ("engine: // user: passwd @ host: port / database")
db = Vino ("sqlite: //db.sqlite")
# Dotaz
db.table ("uživatel"). find (username = 'lepture "). fetch ()
# Vytvářet
db.table ("uživatel") vytvořit. (username = 'lepture', webové stránky = 'http: //lepture.com ")
db.commit ()
# Aktualizace
db.table ("uživatel"). find (username = 'lepture "). Aktualizace (username =' Hsiaoming Yang")
db.commit ()
# Smazat
db.table ("uživatel"). find (username = 'lepture "). delete ()
db.commit ()
Nastavení
Budeme podporovat pouze sqlite3 a MySQL nyní.
SQLite
SQLite s relativní cestu:
db = Vino ("sqlite: //relative/path/db.sqlite")
SQLite s absolutní cestou:
db = Vino ("sqlite: ///root/path/db.sqlite")
Vezměte prosím na vědomí, že je to odlišné od SQLAlchemy.
MySQL
MySQL s veškeré informace:
db = Vino ("mysql: // lepture: 123456 @ localhost: 3306 / test")
MySQL s méně informací:
db = Vino ("mysql: // lepture @ localhost / test")
Výchozí port je 3306.
Vezměte prosím na vědomí, že je to utf8 ve výchozím nastavení.
Query
Najít všechny údaje:
db.table ("uživatel"). fetch ()
Hledat všechny uvedené údaje:
db.table ("uživatel"). find (username = 'lepture "). fetch ()
Najít první údaje:
# Načtení 1 nevrátí seznam
db.table ("uživatel"). find (username = 'lepture "). aport (1)
Limit na dotaz:
db.table ("uživatel"). najít (username = 'lepture "). aport (5, offset = 3)
Více filtry:
db.table ("uživatel"). find (username = 'lepture', věk = 20) .fetch ()
Pokročilé filtry:
# Stejně jako Django
db.table ("uživatel"). find (age__in = [20, 22]). fetch ()
db.table ("uživatel"). find (age__gt = 20) .fetch ()
db.table ("uživatel"). find (age__lt = 20) .fetch ()
db.table ("uživatel"). find (age__gte = 20) .fetch ()
db.table ("uživatel"). find (age__lte = 20) .fetch ()
# Více naleznete v dokumentaci
Vyspělejší filtry:
db.table ("uživatel"). find (age__ne = 20) .fetch () # není rovno
db.table ("uživatel"). find (age__nin = [20, 22]). načíst () # ne
# Více naleznete v dokumentaci
Query pořadí:
. db.table ("uživatel"), najít (věk = 20) .order ("- id"). přines ()
Odstranit
Smazat všechna data:
db.table ("uživatel"). delete ()
db.commit ()
Odstranění stanovené údaje:
db.table ("uživatel"). find (username = 'lepture "). delete ()
db.commit ()

Požadavky na :

  • Python

Podobný software

Ostatní software developer Hsiaoming Yang

Selection.js
Selection.js

10 Dec 15

yue.css
yue.css

12 May 15

Komentáře k Vino

Komentáře nebyl nalezen
Přidat komentář
Zapnout obrázky!