Skip to content

Commit

Permalink
Add SQLite main
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Externbrink committed Jul 5, 2017
1 parent fcb6be0 commit a2c0ffe
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# OrcID_
# ORC-Schlange
18 changes: 18 additions & 0 deletions Tutorial/01 SQLite in Python/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from sqlite3 import connect

class DB:
def __init__(self,path="example/people.db"):
self.conn = connect(path)
self.c = self.conn.cursor()

def getList(self):
self.c.execute('SELECT * FROM people')
return self.c.fetchall()

def close(self):
self.conn.close()

if __name__ == "__main__":
db = DB()
print(db.getList())
db.close()
14 changes: 14 additions & 0 deletions Tutorial/01 SQLite in Python/sql_fill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sqlite3

conn = sqlite3.connect('example/people.db')
c = conn.cursor()

c.execute("DROP TABLE people")
c.execute("CREATE TABLE people (orcid CHARACTER(16), start DATE, end DATE)")
c.execute("INSERT INTO people VALUES ('0000000219094153','1900-01-01','2016-12-31')")
c.execute("INSERT INTO people VALUES ('000000020183570X','1900-01-01','2016-12-31')")
c.execute("INSERT INTO people VALUES ('0000000303977442','1900-01-01','2016-12-31')")

conn.commit()

conn.close()

0 comments on commit a2c0ffe

Please sign in to comment.