Exploration de la db avec sqlachemy
This commit is contained in:
parent
90fbff967d
commit
406e88f74a
861
Notes/sqlalchemy.ipynb
Normal file
861
Notes/sqlalchemy.ipynb
Normal file
@ -0,0 +1,861 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"# Récupération de l'ORM!"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from sqlalchemy import create_engine\n",
|
||||||
|
"from sqlalchemy.ext.declarative import declarative_base\n",
|
||||||
|
"from sqlalchemy.orm import sessionmaker\n",
|
||||||
|
"from sqlalchemy import Table, Column, Integer, ForeignKey\n",
|
||||||
|
"from sqlalchemy.orm import relationship\n",
|
||||||
|
"import pandas as pd"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"dbPath = 'recopytex.db'\n",
|
||||||
|
"engine = create_engine('sqlite:///%s' % dbPath, echo=True)\n",
|
||||||
|
"Base = declarative_base(engine)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2018-02-19 07:54:25,524 INFO sqlalchemy.engine.base.Engine SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1\n",
|
||||||
|
"2018-02-19 07:54:25,525 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,527 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1\n",
|
||||||
|
"2018-02-19 07:54:25,528 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,530 INFO sqlalchemy.engine.base.Engine PRAGMA table_info(\"student\")\n",
|
||||||
|
"2018-02-19 07:54:25,532 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,536 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'student' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,537 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,540 INFO sqlalchemy.engine.base.Engine PRAGMA foreign_key_list(\"student\")\n",
|
||||||
|
"2018-02-19 07:54:25,541 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,543 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'student' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,544 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,553 INFO sqlalchemy.engine.base.Engine PRAGMA table_info(\"tribe\")\n",
|
||||||
|
"2018-02-19 07:54:25,554 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,557 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'tribe' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,558 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,560 INFO sqlalchemy.engine.base.Engine PRAGMA foreign_key_list(\"tribe\")\n",
|
||||||
|
"2018-02-19 07:54:25,566 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,569 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'tribe' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,570 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,571 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"tribe\")\n",
|
||||||
|
"2018-02-19 07:54:25,573 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,574 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"tribe\")\n",
|
||||||
|
"2018-02-19 07:54:25,575 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,577 INFO sqlalchemy.engine.base.Engine PRAGMA index_info(\"sqlite_autoindex_tribe_1\")\n",
|
||||||
|
"2018-02-19 07:54:25,578 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,579 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'tribe' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,580 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,593 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"student\")\n",
|
||||||
|
"2018-02-19 07:54:25,594 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,595 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"student\")\n",
|
||||||
|
"2018-02-19 07:54:25,596 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,598 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'student' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,599 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,613 INFO sqlalchemy.engine.base.Engine PRAGMA table_info(\"eval\")\n",
|
||||||
|
"2018-02-19 07:54:25,614 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,617 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'eval' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,618 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,620 INFO sqlalchemy.engine.base.Engine PRAGMA foreign_key_list(\"eval\")\n",
|
||||||
|
"2018-02-19 07:54:25,621 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,623 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'eval' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,624 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,626 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"eval\")\n",
|
||||||
|
"2018-02-19 07:54:25,627 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,629 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"eval\")\n",
|
||||||
|
"2018-02-19 07:54:25,630 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,631 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'eval' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,632 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,640 INFO sqlalchemy.engine.base.Engine PRAGMA table_info(\"exercise\")\n",
|
||||||
|
"2018-02-19 07:54:25,642 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,644 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'exercise' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,646 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,648 INFO sqlalchemy.engine.base.Engine PRAGMA foreign_key_list(\"exercise\")\n",
|
||||||
|
"2018-02-19 07:54:25,649 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,651 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'exercise' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,652 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,655 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"exercise\")\n",
|
||||||
|
"2018-02-19 07:54:25,661 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,668 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"exercise\")\n",
|
||||||
|
"2018-02-19 07:54:25,669 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,671 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'exercise' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,671 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,678 INFO sqlalchemy.engine.base.Engine PRAGMA table_info(\"question\")\n",
|
||||||
|
"2018-02-19 07:54:25,679 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,682 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'question' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,683 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,684 INFO sqlalchemy.engine.base.Engine PRAGMA foreign_key_list(\"question\")\n",
|
||||||
|
"2018-02-19 07:54:25,685 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,686 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'question' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,688 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,691 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"question\")\n",
|
||||||
|
"2018-02-19 07:54:25,692 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,693 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"question\")\n",
|
||||||
|
"2018-02-19 07:54:25,694 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,698 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'question' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,699 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,704 INFO sqlalchemy.engine.base.Engine PRAGMA table_info(\"score\")\n",
|
||||||
|
"2018-02-19 07:54:25,705 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,706 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'score' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,707 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,709 INFO sqlalchemy.engine.base.Engine PRAGMA foreign_key_list(\"score\")\n",
|
||||||
|
"2018-02-19 07:54:25,710 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,711 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'score' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,712 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,714 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"score\")\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2018-02-19 07:54:25,715 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,716 INFO sqlalchemy.engine.base.Engine PRAGMA index_list(\"score\")\n",
|
||||||
|
"2018-02-19 07:54:25,717 INFO sqlalchemy.engine.base.Engine ()\n",
|
||||||
|
"2018-02-19 07:54:25,718 INFO sqlalchemy.engine.base.Engine SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = 'score' AND type = 'table'\n",
|
||||||
|
"2018-02-19 07:54:25,719 INFO sqlalchemy.engine.base.Engine ()\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"class Student(Base):\n",
|
||||||
|
" \"\"\"\"\"\"\n",
|
||||||
|
" __tablename__ = 'student'\n",
|
||||||
|
" __table_args__ = {'autoload':True}\n",
|
||||||
|
" \n",
|
||||||
|
" scores = relationship(\"Score\", backref=\"student\")\n",
|
||||||
|
" \n",
|
||||||
|
" @property\n",
|
||||||
|
" def fullname(self):\n",
|
||||||
|
" if self.surname:\n",
|
||||||
|
" return ' '.join([self.name.upper(), self.surname.capitalize()])\n",
|
||||||
|
"\n",
|
||||||
|
" return self.name.upper()\n",
|
||||||
|
" \n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return f\"<Student {self.fullname}>\"\n",
|
||||||
|
" \n",
|
||||||
|
" def to_df(self, columns = [\"id\", \"name\", \"surname\", \"fullname\", \"tribe_id\"]):\n",
|
||||||
|
" cara_dict = {c:self.__getattribute__(c) for c in columns}\n",
|
||||||
|
" return pd.DataFrame.from_dict([cara_dict])\n",
|
||||||
|
" \n",
|
||||||
|
" def score_df(self, with_self=True):\n",
|
||||||
|
" scs_df = pd.concat([sc.to_df() for sc in seld.scores])\n",
|
||||||
|
" if with_self:\n",
|
||||||
|
" self_df = self.to_df()\n",
|
||||||
|
" return pd.merge(scs_df, self_df, left_on=\"student_id\", right_on=\"id\")\n",
|
||||||
|
" else:\n",
|
||||||
|
" return scs_df\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"class Tribe(Base):\n",
|
||||||
|
" \"\"\"\"\"\"\n",
|
||||||
|
" __tablename__ = 'tribe'\n",
|
||||||
|
" __table_args__ = {'autoload':True}\n",
|
||||||
|
" \n",
|
||||||
|
" students = relationship(\"Student\", backref=\"tribe\")\n",
|
||||||
|
" evals = relationship(\"Eval\", backref=\"tribe\")\n",
|
||||||
|
"\n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return f\"<Tribe {self.name}>\"\n",
|
||||||
|
" \n",
|
||||||
|
" def to_df(self, columns = [\"id\", \"name\", \"grade\"]):\n",
|
||||||
|
" cara_dict = {c:self.__getattribute__(c) for c in columns}\n",
|
||||||
|
" return pd.DataFrame.from_dict([cara_dict])\n",
|
||||||
|
" \n",
|
||||||
|
" def students_df(self, columns=[\"id\", \"name\", \"surname\", \"fullname\", \"tribe_id\"]):\n",
|
||||||
|
" dfs = []\n",
|
||||||
|
" for s in self.students:\n",
|
||||||
|
" dfs.append(s.to_df())\n",
|
||||||
|
" return pd.concat(dfs)\n",
|
||||||
|
"\n",
|
||||||
|
"class Eval(Base):\n",
|
||||||
|
" \"\"\"\"\"\"\n",
|
||||||
|
" __tablename__ = 'eval'\n",
|
||||||
|
" __table_args__ = {'autoload':True}\n",
|
||||||
|
" \n",
|
||||||
|
" exercises = relationship(\"Exercise\", backref=\"Eval\")\n",
|
||||||
|
" \n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return f\"<Eval {self.name} for Tribe{self.tribe_id}>\"\n",
|
||||||
|
" \n",
|
||||||
|
" @property\n",
|
||||||
|
" def score_rate(self):\n",
|
||||||
|
" return sum([ex.score_rate for ex in self.exercises])\n",
|
||||||
|
"\n",
|
||||||
|
"class Exercise(Base):\n",
|
||||||
|
" \"\"\"\"\"\"\n",
|
||||||
|
" __tablename__ = 'exercise'\n",
|
||||||
|
" __table_args__ = {'autoload':True}\n",
|
||||||
|
" \n",
|
||||||
|
" questions = relationship(\"Question\", backref=\"exercise\")\n",
|
||||||
|
" \n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return f\"<Exercise {self.name} for Eval{self.eval_id}>\"\n",
|
||||||
|
" \n",
|
||||||
|
" @property\n",
|
||||||
|
" def score_rate(self):\n",
|
||||||
|
" return sum([q.score_rate for q in self.questions])\n",
|
||||||
|
"\n",
|
||||||
|
"class Question(Base):\n",
|
||||||
|
" \"\"\"\"\"\"\n",
|
||||||
|
" __tablename__ = 'question'\n",
|
||||||
|
" __table_args__ = {'autoload':True}\n",
|
||||||
|
" \n",
|
||||||
|
" scores = relationship(\"Score\", backref=\"question\")\n",
|
||||||
|
" \n",
|
||||||
|
" def __repr__(self):\n",
|
||||||
|
" return f\"<Question {self.name} for Exercise{self.exercise_id}>\" \n",
|
||||||
|
" \n",
|
||||||
|
" def to_df(self,\\\n",
|
||||||
|
" columns = [\"id\", \"name\", \"score_rate\",\\\n",
|
||||||
|
" \"is_leveled\", \"exercise_id\",\\\n",
|
||||||
|
" \"competence\", \"domain\", \"comment\"],\\\n",
|
||||||
|
" ):\n",
|
||||||
|
" cara_dict = {c:self.__getattribute__(c) for c in columns}\n",
|
||||||
|
" return pd.DataFrame.from_dict([cara_dict])\n",
|
||||||
|
"\n",
|
||||||
|
"class Score(Base):\n",
|
||||||
|
" \"\"\"\"\"\"\n",
|
||||||
|
" __tablename__ = 'score'\n",
|
||||||
|
" __table_args__ = {'autoload':True}\n",
|
||||||
|
" \n",
|
||||||
|
" def to_df(self, question=True, student=True):\n",
|
||||||
|
" score_dict = {c:self.__getattribute__(c) for c in [\"student_id\", \"question_id\", \"value\"]}\n",
|
||||||
|
" score_df = pd.DataFrame.from_dict([score_dict])\n",
|
||||||
|
" \n",
|
||||||
|
" # pas pratique la gestion des suffixes\n",
|
||||||
|
" # Il faudrait changer le nom des colonnes\n",
|
||||||
|
" if question:\n",
|
||||||
|
" qu_df = self.question.to_df()\n",
|
||||||
|
" score_df = pd.merge(score_df, qu_df,\\\n",
|
||||||
|
" left_on='question_id', right_on='id',\\\n",
|
||||||
|
" suffixes=('_score', '_question'))\n",
|
||||||
|
" \n",
|
||||||
|
" if student:\n",
|
||||||
|
" s_df = self.student.to_df()\n",
|
||||||
|
" score_df = pd.merge(score_df, s_df,\\\n",
|
||||||
|
" left_on='student_id', right_on='id',\\\n",
|
||||||
|
" suffixes=('_score', '_student'))\n",
|
||||||
|
" return score_df\n",
|
||||||
|
" "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"def loadSession():\n",
|
||||||
|
" \"\"\"\"\"\"\n",
|
||||||
|
" metadata = Base.metadata\n",
|
||||||
|
" Session = sessionmaker(bind=engine)\n",
|
||||||
|
" session = Session()\n",
|
||||||
|
" return session"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"session = loadSession()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2018-02-19 07:54:25,781 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)\n",
|
||||||
|
"2018-02-19 07:54:25,783 INFO sqlalchemy.engine.base.Engine SELECT tribe.id AS tribe_id, tribe.name AS tribe_name, tribe.grade AS tribe_grade \n",
|
||||||
|
"FROM tribe\n",
|
||||||
|
"2018-02-19 07:54:25,784 INFO sqlalchemy.engine.base.Engine ()\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"tribes = session.query(Tribe).all()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"<Tribe 302>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 7,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"t = tribes[0]\n",
|
||||||
|
"t"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 8,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<div>\n",
|
||||||
|
"<style>\n",
|
||||||
|
" .dataframe thead tr:only-child th {\n",
|
||||||
|
" text-align: right;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe thead th {\n",
|
||||||
|
" text-align: left;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe tbody tr th {\n",
|
||||||
|
" vertical-align: top;\n",
|
||||||
|
" }\n",
|
||||||
|
"</style>\n",
|
||||||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||||||
|
" <thead>\n",
|
||||||
|
" <tr style=\"text-align: right;\">\n",
|
||||||
|
" <th></th>\n",
|
||||||
|
" <th>grade</th>\n",
|
||||||
|
" <th>id</th>\n",
|
||||||
|
" <th>name</th>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </thead>\n",
|
||||||
|
" <tbody>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>0</th>\n",
|
||||||
|
" <td>3e</td>\n",
|
||||||
|
" <td>1</td>\n",
|
||||||
|
" <td>302</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </tbody>\n",
|
||||||
|
"</table>\n",
|
||||||
|
"</div>"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
" grade id name\n",
|
||||||
|
"0 3e 1 302"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 8,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"t.to_df()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 9,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2018-02-19 07:54:25,841 INFO sqlalchemy.engine.base.Engine SELECT eval.id AS eval_id, eval.name AS eval_name, eval.term AS eval_term, eval.type AS eval_type, eval.comment AS eval_comment, eval.tribe_id AS eval_tribe_id \n",
|
||||||
|
"FROM eval \n",
|
||||||
|
"WHERE ? = eval.tribe_id\n",
|
||||||
|
"2018-02-19 07:54:25,843 INFO sqlalchemy.engine.base.Engine (1,)\n",
|
||||||
|
"2018-02-19 07:54:25,847 INFO sqlalchemy.engine.base.Engine SELECT exercise.id AS exercise_id, exercise.name AS exercise_name, exercise.eval_id AS exercise_eval_id, exercise.date AS exercise_date, exercise.comment AS exercise_comment \n",
|
||||||
|
"FROM exercise \n",
|
||||||
|
"WHERE ? = exercise.eval_id\n",
|
||||||
|
"2018-02-19 07:54:25,852 INFO sqlalchemy.engine.base.Engine (1,)\n",
|
||||||
|
"2018-02-19 07:54:25,858 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,859 INFO sqlalchemy.engine.base.Engine (1,)\n",
|
||||||
|
"2018-02-19 07:54:25,863 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,873 INFO sqlalchemy.engine.base.Engine (2,)\n",
|
||||||
|
"Evaluation DS1 mise en jambe sur 0\n",
|
||||||
|
"Ex 1 - Prendre la température sur 0\n",
|
||||||
|
"\tQu 1 Lecture du thermomètre sur 0\n",
|
||||||
|
"\tQu 2 Suivre programme de calculs sur 0\n",
|
||||||
|
"\tQu 2.c Renverser un programme de calculs sur 0\n",
|
||||||
|
"Ex 2 - Maladroite! sur 0\n",
|
||||||
|
"\tQu Lire le tableau et le graphique sur 0\n",
|
||||||
|
"\tQu Décomposer le problème sur 0\n",
|
||||||
|
"\tQu Manipuler les grandeurs sur 0\n",
|
||||||
|
"\tQu Mener à bien les calculs sur 0\n",
|
||||||
|
"\tQu Rédaction sur 0\n",
|
||||||
|
"--------------------\n",
|
||||||
|
"2018-02-19 07:54:25,876 INFO sqlalchemy.engine.base.Engine SELECT exercise.id AS exercise_id, exercise.name AS exercise_name, exercise.eval_id AS exercise_eval_id, exercise.date AS exercise_date, exercise.comment AS exercise_comment \n",
|
||||||
|
"FROM exercise \n",
|
||||||
|
"WHERE ? = exercise.eval_id\n",
|
||||||
|
"2018-02-19 07:54:25,878 INFO sqlalchemy.engine.base.Engine (5,)\n",
|
||||||
|
"2018-02-19 07:54:25,880 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,881 INFO sqlalchemy.engine.base.Engine (12,)\n",
|
||||||
|
"2018-02-19 07:54:25,883 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,885 INFO sqlalchemy.engine.base.Engine (13,)\n",
|
||||||
|
"2018-02-19 07:54:25,887 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,888 INFO sqlalchemy.engine.base.Engine (14,)\n",
|
||||||
|
"2018-02-19 07:54:25,891 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,893 INFO sqlalchemy.engine.base.Engine (15,)\n",
|
||||||
|
"Evaluation DS2 sur 0\n",
|
||||||
|
"Ex 1 - Techniques sur 0\n",
|
||||||
|
"\tQu 1 Ordre et écriture sur 0\n",
|
||||||
|
"\tQu 2 et 3 Diviseur et décomposition sur 0\n",
|
||||||
|
"Ex 2 - Agrandissement sur 0\n",
|
||||||
|
"\tQu Comment agrandir sur 0\n",
|
||||||
|
"\tQu Rédaction et explications sur 0\n",
|
||||||
|
"Ex 3 - Confiseries sur 0\n",
|
||||||
|
"\tQu 1 Nombre bonbons sur 0\n",
|
||||||
|
"\tQu 2 et 3 Écriture des probabiltés sur 0\n",
|
||||||
|
"\tQu 3 Plus probable sur 0\n",
|
||||||
|
"\tQu 4 Calculs de compositions sur 0\n",
|
||||||
|
"\tQu 4.b Raisonnement sur 0\n",
|
||||||
|
"Ex 4 - Rangement sur 0\n",
|
||||||
|
"\tQu Choix des opérations sur 0\n",
|
||||||
|
"\tQu Explications sur 0\n",
|
||||||
|
"--------------------\n",
|
||||||
|
"2018-02-19 07:54:25,896 INFO sqlalchemy.engine.base.Engine SELECT exercise.id AS exercise_id, exercise.name AS exercise_name, exercise.eval_id AS exercise_eval_id, exercise.date AS exercise_date, exercise.comment AS exercise_comment \n",
|
||||||
|
"FROM exercise \n",
|
||||||
|
"WHERE ? = exercise.eval_id\n",
|
||||||
|
"2018-02-19 07:54:25,899 INFO sqlalchemy.engine.base.Engine (8,)\n",
|
||||||
|
"2018-02-19 07:54:25,902 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,903 INFO sqlalchemy.engine.base.Engine (22,)\n",
|
||||||
|
"Evaluation Pyramide de pièces sur 0\n",
|
||||||
|
"Ex sur 0\n",
|
||||||
|
"\tQu Clarté des explications, utilisation du vocabulaire sur 0\n",
|
||||||
|
"\tQu Mener un raisonnement sur 0\n",
|
||||||
|
"\tQu Mener à bien les calculs sur 0\n",
|
||||||
|
"\tQu Dessins et tableur sur 0\n",
|
||||||
|
"\tQu Rendu à temps sur 0\n",
|
||||||
|
"--------------------\n",
|
||||||
|
"2018-02-19 07:54:25,912 INFO sqlalchemy.engine.base.Engine SELECT exercise.id AS exercise_id, exercise.name AS exercise_name, exercise.eval_id AS exercise_eval_id, exercise.date AS exercise_date, exercise.comment AS exercise_comment \n",
|
||||||
|
"FROM exercise \n",
|
||||||
|
"WHERE ? = exercise.eval_id\n",
|
||||||
|
"2018-02-19 07:54:25,916 INFO sqlalchemy.engine.base.Engine (10,)\n",
|
||||||
|
"2018-02-19 07:54:25,919 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,920 INFO sqlalchemy.engine.base.Engine (27,)\n",
|
||||||
|
"2018-02-19 07:54:25,923 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,926 INFO sqlalchemy.engine.base.Engine (28,)\n",
|
||||||
|
"2018-02-19 07:54:25,929 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,930 INFO sqlalchemy.engine.base.Engine (29,)\n",
|
||||||
|
"2018-02-19 07:54:25,932 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,933 INFO sqlalchemy.engine.base.Engine (30,)\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Evaluation DS3 sur 17.0\n",
|
||||||
|
"Ex 1 -QCM sur 4\n",
|
||||||
|
"\tQu sur 4\n",
|
||||||
|
"Ex 2 sur 5.0\n",
|
||||||
|
"\tQu Explications des calculs sur 1.5\n",
|
||||||
|
"\tQu Formule tableur sur 1\n",
|
||||||
|
"\tQu Choix des opérations sur 1\n",
|
||||||
|
"\tQu Manipulation des grands nombres sur 0.5\n",
|
||||||
|
"\tQu Comparaison sur 1\n",
|
||||||
|
"Ex 3 sur 5\n",
|
||||||
|
"\tQu 1 Démontrer parallèle sur 1\n",
|
||||||
|
"\tQu 2 Reconnaître Thalès sur 1\n",
|
||||||
|
"\tQu 2 Calculer EC sur 1\n",
|
||||||
|
"\tQu 2 Rédaction sur 1\n",
|
||||||
|
"\tQu 2 Conversions sur 1\n",
|
||||||
|
"Ex 4 sur 3\n",
|
||||||
|
"\tQu Utiliser les bonnes informations sur 1\n",
|
||||||
|
"\tQu Choix des calculs sur 1\n",
|
||||||
|
"\tQu Reconnaître fractions sur 1\n",
|
||||||
|
"--------------------\n",
|
||||||
|
"2018-02-19 07:54:25,941 INFO sqlalchemy.engine.base.Engine SELECT exercise.id AS exercise_id, exercise.name AS exercise_name, exercise.eval_id AS exercise_eval_id, exercise.date AS exercise_date, exercise.comment AS exercise_comment \n",
|
||||||
|
"FROM exercise \n",
|
||||||
|
"WHERE ? = exercise.eval_id\n",
|
||||||
|
"2018-02-19 07:54:25,944 INFO sqlalchemy.engine.base.Engine (14,)\n",
|
||||||
|
"2018-02-19 07:54:25,947 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,949 INFO sqlalchemy.engine.base.Engine (38,)\n",
|
||||||
|
"2018-02-19 07:54:25,952 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,953 INFO sqlalchemy.engine.base.Engine (39,)\n",
|
||||||
|
"2018-02-19 07:54:25,959 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,961 INFO sqlalchemy.engine.base.Engine (40,)\n",
|
||||||
|
"Evaluation DM noel sur 11\n",
|
||||||
|
"Ex 1 techniques de calculs sur 5\n",
|
||||||
|
"\tQu 1 Fractions à trou sur 1\n",
|
||||||
|
"\tQu 2 Calculs fraction sur 1\n",
|
||||||
|
"\tQu 3 Evaluer sur 1\n",
|
||||||
|
"\tQu 3 Priorité de calculs sur 1\n",
|
||||||
|
"\tQu 4 Réduire une expression sur 1\n",
|
||||||
|
"Ex 2 Thalès sur 2\n",
|
||||||
|
"\tQu Rédaction du théorème de Thalès sur 1\n",
|
||||||
|
"\tQu Utilisation du théorème sur 1\n",
|
||||||
|
"Ex 3 Mes bonbons préférés sur 4\n",
|
||||||
|
"\tQu 1 Nombre d'issues sur 1\n",
|
||||||
|
"\tQu 2 à 5 Calculer un probabilité sur 1\n",
|
||||||
|
"\tQu 2 à 5 Vocabulaire et explications sur 1\n",
|
||||||
|
"\tQu 5 Comparaison de probabilité sur 1\n",
|
||||||
|
"--------------------\n",
|
||||||
|
"2018-02-19 07:54:25,972 INFO sqlalchemy.engine.base.Engine SELECT exercise.id AS exercise_id, exercise.name AS exercise_name, exercise.eval_id AS exercise_eval_id, exercise.date AS exercise_date, exercise.comment AS exercise_comment \n",
|
||||||
|
"FROM exercise \n",
|
||||||
|
"WHERE ? = exercise.eval_id\n",
|
||||||
|
"2018-02-19 07:54:25,975 INFO sqlalchemy.engine.base.Engine (16,)\n",
|
||||||
|
"2018-02-19 07:54:25,977 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,978 INFO sqlalchemy.engine.base.Engine (43,)\n",
|
||||||
|
"2018-02-19 07:54:25,980 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,983 INFO sqlalchemy.engine.base.Engine (44,)\n",
|
||||||
|
"2018-02-19 07:54:25,986 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,988 INFO sqlalchemy.engine.base.Engine (45,)\n",
|
||||||
|
"2018-02-19 07:54:25,990 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,991 INFO sqlalchemy.engine.base.Engine (46,)\n",
|
||||||
|
"2018-02-19 07:54:25,994 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,996 INFO sqlalchemy.engine.base.Engine (47,)\n",
|
||||||
|
"2018-02-19 07:54:25,997 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:25,998 INFO sqlalchemy.engine.base.Engine (51,)\n",
|
||||||
|
"Evaluation DS4 sur 38\n",
|
||||||
|
"Ex 1 QCM sur 6\n",
|
||||||
|
"\tQu 1 à 3 sur 3\n",
|
||||||
|
"\tQu 4 à 6 sur 3\n",
|
||||||
|
"Ex 2 Bien assis? sur 5\n",
|
||||||
|
"\tQu Reconnaître Thalès sur 1\n",
|
||||||
|
"\tQu Rédaction sur 2\n",
|
||||||
|
"\tQu Les calculs sur 2\n",
|
||||||
|
"Ex 3 L'urne sur 6\n",
|
||||||
|
"\tQu 1 à 3 Calculer une probabillté sur 2\n",
|
||||||
|
"\tQu 2 Comparer des probabilités sur 1\n",
|
||||||
|
"\tQu 2 Penser au probabilités sur 1\n",
|
||||||
|
"\tQu 3 Changement de situation sur 2\n",
|
||||||
|
"Ex 4 Programme de calculs sur 7\n",
|
||||||
|
"\tQu Phrase de Sophie et Gabriel sur 3\n",
|
||||||
|
"\tQu Phrase de Martin sur 2\n",
|
||||||
|
"\tQu Développer (Faïza) sur 1\n",
|
||||||
|
"\tQu Reconnaître le double sur 1\n",
|
||||||
|
"Ex 5 Roule cycliste sur 8\n",
|
||||||
|
"\tQu 1.a Calcul de la distance sur 1\n",
|
||||||
|
"\tQu 1.b Formule tableur sur 1\n",
|
||||||
|
"\tQu 1.c Construction de la fonction sur 1\n",
|
||||||
|
"\tQu 1.d Calcul du temps sur 1\n",
|
||||||
|
"\tQu 2 a et b Lecture graphique sur 2\n",
|
||||||
|
"\tQu 2.c Calcul de la distance sur 1\n",
|
||||||
|
"\tQu d Reconnaître la proportionnalité sur 1\n",
|
||||||
|
"Ex Présentation sur 6\n",
|
||||||
|
"\tQu sur 6\n",
|
||||||
|
"--------------------\n",
|
||||||
|
"2018-02-19 07:54:26,001 INFO sqlalchemy.engine.base.Engine SELECT exercise.id AS exercise_id, exercise.name AS exercise_name, exercise.eval_id AS exercise_eval_id, exercise.date AS exercise_date, exercise.comment AS exercise_comment \n",
|
||||||
|
"FROM exercise \n",
|
||||||
|
"WHERE ? = exercise.eval_id\n",
|
||||||
|
"2018-02-19 07:54:26,004 INFO sqlalchemy.engine.base.Engine (21,)\n",
|
||||||
|
"2018-02-19 07:54:26,006 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:26,007 INFO sqlalchemy.engine.base.Engine (64,)\n",
|
||||||
|
"2018-02-19 07:54:26,010 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:26,011 INFO sqlalchemy.engine.base.Engine (65,)\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2018-02-19 07:54:26,012 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:26,013 INFO sqlalchemy.engine.base.Engine (66,)\n",
|
||||||
|
"2018-02-19 07:54:26,015 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:26,016 INFO sqlalchemy.engine.base.Engine (67,)\n",
|
||||||
|
"2018-02-19 07:54:26,017 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:26,018 INFO sqlalchemy.engine.base.Engine (68,)\n",
|
||||||
|
"2018-02-19 07:54:26,020 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:26,021 INFO sqlalchemy.engine.base.Engine (69,)\n",
|
||||||
|
"2018-02-19 07:54:26,023 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:26,024 INFO sqlalchemy.engine.base.Engine (70,)\n",
|
||||||
|
"2018-02-19 07:54:26,025 INFO sqlalchemy.engine.base.Engine SELECT question.id AS question_id, question.name AS question_name, question.score_rate AS question_score_rate, question.is_leveled AS question_is_leveled, question.exercise_id AS question_exercise_id, question.competence AS question_competence, question.domain AS question_domain, question.comment AS question_comment \n",
|
||||||
|
"FROM question \n",
|
||||||
|
"WHERE ? = question.exercise_id\n",
|
||||||
|
"2018-02-19 07:54:26,027 INFO sqlalchemy.engine.base.Engine (91,)\n",
|
||||||
|
"Evaluation DNB blanc1 sur 100\n",
|
||||||
|
"Ex 1 - QCM sur 10\n",
|
||||||
|
"\tQu 1 QCM sur 2\n",
|
||||||
|
"\tQu 2 QCM sur 2\n",
|
||||||
|
"\tQu 3 QCM sur 2\n",
|
||||||
|
"\tQu 4 QCM sur 2\n",
|
||||||
|
"\tQu 5 QCM sur 2\n",
|
||||||
|
"Ex 2 - Boite de chocolat sur 10\n",
|
||||||
|
"\tQu 1 à 3 Calcul proba sur 4\n",
|
||||||
|
"\tQu 2 Modification situation sur 3\n",
|
||||||
|
"\tQu 3 Nouvelle composition sur 3\n",
|
||||||
|
"Ex 3 - Scratch sur 10\n",
|
||||||
|
"\tQu 1 Que fait le programme sur 3\n",
|
||||||
|
"\tQu 2 Réponse à 13 sur 4\n",
|
||||||
|
"\tQu 3 Age pour conduire sur 3\n",
|
||||||
|
"Ex 4 - Programme de calcul sur 15\n",
|
||||||
|
"\tQu 1 Application du calcul sur 5\n",
|
||||||
|
"\tQu 2 Renverser le calcul sur 4\n",
|
||||||
|
"\tQu 3 Appliquer à x et developper sur 6\n",
|
||||||
|
"Ex 5 - Macaron sur 15\n",
|
||||||
|
"\tQu 1 Proportionnalité sur 3\n",
|
||||||
|
"\tQu 2 et 4 Lecture graphique sur 4\n",
|
||||||
|
"\tQu 3 Écart de température sur 4\n",
|
||||||
|
"\tQu 4 Satisfaction sur 4\n",
|
||||||
|
"Ex 6 - Inspecteur sur 15\n",
|
||||||
|
"\tQu 1 Hypothèses sur 2\n",
|
||||||
|
"\tQu 1 Reconnaissance des théorèmes sur 3\n",
|
||||||
|
"\tQu 1 Calculs dans les théorèmes sur 4\n",
|
||||||
|
"\tQu 1 Réponse à la question sur 3\n",
|
||||||
|
"\tQu 2 Confiance au pilote sur 3\n",
|
||||||
|
"Ex 7 - La tache sur 15\n",
|
||||||
|
"\tQu Décomposition du problème sur 3\n",
|
||||||
|
"\tQu Lecture des informations sur 4\n",
|
||||||
|
"\tQu Calculs sensé sur 4\n",
|
||||||
|
"\tQu Clarté des explications sur 4\n",
|
||||||
|
"Ex Présentation sur 10\n",
|
||||||
|
"\tQu sur 10\n",
|
||||||
|
"--------------------\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"for ev in t.evals:\n",
|
||||||
|
" print(f\"Evaluation {ev.name} sur {ev.score_rate}\")\n",
|
||||||
|
" for ex in ev.exercises:\n",
|
||||||
|
" print(f\"Ex {ex.name} sur {ex.score_rate}\")\n",
|
||||||
|
" for qu in ex.questions:\n",
|
||||||
|
" print(f\"\\tQu {qu.name} {qu.comment} sur {qu.score_rate}\")\n",
|
||||||
|
" print(\"-\"*20)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 10,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2018-02-19 07:54:26,040 INFO sqlalchemy.engine.base.Engine SELECT score.id AS score_id, score.question_id AS score_question_id, score.student_id AS score_student_id, score.value AS score_value \n",
|
||||||
|
"FROM score\n",
|
||||||
|
"2018-02-19 07:54:26,043 INFO sqlalchemy.engine.base.Engine ()\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"sc = session.query(Score).all()[123]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 11,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2018-02-19 07:54:26,223 INFO sqlalchemy.engine.base.Engine SELECT student.id AS student_id, student.name AS student_name, student.surname AS student_surname, student.mail AS student_mail, student.commment AS student_commment, student.tribe_id AS student_tribe_id \n",
|
||||||
|
"FROM student \n",
|
||||||
|
"WHERE student.id = ?\n",
|
||||||
|
"2018-02-19 07:54:26,225 INFO sqlalchemy.engine.base.Engine (10,)\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<div>\n",
|
||||||
|
"<style>\n",
|
||||||
|
" .dataframe thead tr:only-child th {\n",
|
||||||
|
" text-align: right;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe thead th {\n",
|
||||||
|
" text-align: left;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe tbody tr th {\n",
|
||||||
|
" vertical-align: top;\n",
|
||||||
|
" }\n",
|
||||||
|
"</style>\n",
|
||||||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||||||
|
" <thead>\n",
|
||||||
|
" <tr style=\"text-align: right;\">\n",
|
||||||
|
" <th></th>\n",
|
||||||
|
" <th>question_id</th>\n",
|
||||||
|
" <th>student_id</th>\n",
|
||||||
|
" <th>value</th>\n",
|
||||||
|
" <th>comment</th>\n",
|
||||||
|
" <th>competence</th>\n",
|
||||||
|
" <th>domain</th>\n",
|
||||||
|
" <th>exercise_id</th>\n",
|
||||||
|
" <th>id_score</th>\n",
|
||||||
|
" <th>is_leveled</th>\n",
|
||||||
|
" <th>name_score</th>\n",
|
||||||
|
" <th>score_rate</th>\n",
|
||||||
|
" <th>fullname</th>\n",
|
||||||
|
" <th>id_student</th>\n",
|
||||||
|
" <th>name_student</th>\n",
|
||||||
|
" <th>surname</th>\n",
|
||||||
|
" <th>tribe_id</th>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </thead>\n",
|
||||||
|
" <tbody>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>0</th>\n",
|
||||||
|
" <td>4</td>\n",
|
||||||
|
" <td>10</td>\n",
|
||||||
|
" <td>3</td>\n",
|
||||||
|
" <td>Lire le tableau et le graphique</td>\n",
|
||||||
|
" <td>Cher</td>\n",
|
||||||
|
" <td>4opérations</td>\n",
|
||||||
|
" <td>2</td>\n",
|
||||||
|
" <td>4</td>\n",
|
||||||
|
" <td>True</td>\n",
|
||||||
|
" <td></td>\n",
|
||||||
|
" <td>0</td>\n",
|
||||||
|
" <td>ATTOUMANE ALI Fatima</td>\n",
|
||||||
|
" <td>10</td>\n",
|
||||||
|
" <td>ATTOUMANE ALI</td>\n",
|
||||||
|
" <td>Fatima</td>\n",
|
||||||
|
" <td>1</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </tbody>\n",
|
||||||
|
"</table>\n",
|
||||||
|
"</div>"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
" question_id student_id value comment competence \\\n",
|
||||||
|
"0 4 10 3 Lire le tableau et le graphique Cher \n",
|
||||||
|
"\n",
|
||||||
|
" domain exercise_id id_score is_leveled name_score score_rate \\\n",
|
||||||
|
"0 4opérations 2 4 True 0 \n",
|
||||||
|
"\n",
|
||||||
|
" fullname id_student name_student surname tribe_id \n",
|
||||||
|
"0 ATTOUMANE ALI Fatima 10 ATTOUMANE ALI Fatima 1 "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 11,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"sc.to_df()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.6.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user