Vino

Software screenshot:
Vino
Dettagli del software:
Versione: 0.1.0
Data di caricamento: 20 Feb 15
Sviluppatore: Hsiaoming Yang
Licenza: Libero
Popolarità: 2

Rating: nan/5 (Total Votes: 0)

Vino non è ORM. Sì, è vero, non è ORM.
Per Iniziare
Una vista veloce con Vino:
# Impostare
# Db = Vino ('motore: // user: passwd @ host: port / database')
db = Vino ('sqlite: //db.sqlite')
# Query
db.table ('user'). trovare (username = 'lepture'). fetch ()
# Dare vita
db.table ('user') creare. (username = 'lepture', sito = 'http: //lepture.com')
db.commit ()
# Update
db.table ('user'). trovare (username = 'lepture'). update (username = 'Hsiaoming Yang')
db.commit ()
# Cancella
db.table ('user'). trovare (username = 'lepture'). delete ()
db.commit ()
Setup
Sosterremo solo sqlite3 e mysql ormai.
SQLite
SQLite con percorso relativo:
db = Vino ('sqlite: //relative/path/db.sqlite')
SQLite con il percorso assoluto:
db = Vino ('sqlite: ///root/path/db.sqlite')
Si prega di notare, è diverso da SQLAlchemy.
MySQL
MySQL con tutte le informazioni:
db = Vino ('mysql: // lepture: 123456 @ localhost: 3306 / test')
MySQL con meno informazioni:
db = Vino ('mysql: // lepture @ localhost / test')
Porta di default è 3306.
Si prega di notare, è utf8 di default.
Query
Trova tutti i dati:
db.table ('user'). fetch ()
Trova tutti i dati specificati:
db.table ('user'). trovare (username = 'lepture'). fetch ()
Trovare i primi dati:
# 1 operazione di recupero non restituirà un elenco
db.table ('user'). trovare (username = 'lepture'). fetch (1)
Limitare il interrogazione:
db.table ('user'). trovare (username = 'lepture'). fetch (5, offset = 3)
Più filtri:
db.table ('user'). trovare (username = 'lepture', età = 20) .fetch ()
Filtri avanzati:
# Come Django
db.table ('user'). trovare (age__in = [20, 22]). fetch ()
db.table ('user'). trovare (age__gt = 20) .fetch ()
db.table ('user'). trovare (age__lt = 20) .fetch ()
db.table ('user'). trovano (age__gte = 20) .fetch ()
db.table ('user'). trovano (age__lte = 20) .fetch ()
# Più vedere la documentazione
I filtri più avanzati:
db.table ('user'). trovare (age__ne = 20) .fetch () # non uguale
db.table ('user'). trovare (age__nin = [20, 22]). fetch () # non a
# Più vedere la documentazione
Ordine Query:
. db.table ('user') trovare (età = 20) .order ('- id'). fetch ()
Elimina
Elimina tutti i dati:
db.table ('user'). delete ()
db.commit ()
Cancellare i dati specificato:
db.table ('user'). trovare (username = 'lepture'). delete ()
db.commit ()

Requisiti :

  • Python

Programmi simili

chive
chive

11 May 15

Products.Undoer
Products.Undoer

15 Apr 15

Psycopg2
Psycopg2

17 Feb 15

Mergeant
Mergeant

2 Jun 15

Altri software di sviluppo Hsiaoming Yang

Selection.js
Selection.js

10 Dec 15

yue.css
yue.css

12 May 15

Commenti a Vino

I commenti non trovato
Aggiungi commento
Accendere le immagini!