Skip to content
Snippets Groups Projects
Verified Commit f35c1bd5 authored by David Beniamine's avatar David Beniamine
Browse files

Netbooks updated

parent b305a8eb
No related branches found
No related tags found
No related merge requests found
......@@ -715,7 +715,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.6"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
......
%% Cell type:code id: tags:
``` python
import pymonetdb
# set up a connection. arguments below are the defaults
connection = pymonetdb.connect(username="monetdb", password="monetdb",
hostname="localDB", database="db")
# create a cursor
cursor = connection.cursor()
# increase the rows fetched to increase performance (optional)
cursor.arraysize = 100
# execute a query (return the number of rows to fetch)
res=cursor.execute('SELECT * FROM tables')
if (res > 0):
print('Successfully connected to localDB with default credentials, please change the monetdb password by running docker-compose exec localDB -d monetdb-r /root/set-monetdb-password.sh <password>')
```
%% Output
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-72adc0183b67> in <module>
----> 1 import pymonetdb
2
3 # set up a connection. arguments below are the defaults
4 connection = pymonetdb.connect(username="monetdb", password="monetdb",
5 hostname="localDB", database="monetdb")
ModuleNotFoundError: No module named 'pymonetdb'
Successfully connected to localDB with default credentials, please change the monetdb password by running docker-compose exec localDB -d monetdb-r /root/set-monetdb-password.sh <password>
%% Cell type:code id: tags:
``` python
```
......
%% Cell type:code id: tags:
``` python
import csv
lines = []
with open('test.csv') as csv_file:
dialect = csv.Sniffer().sniff(csv_file.read(1024))
csv_file.seek(0)
reader = csv.reader(csv_file, dialect)
for row in reader:
lines.append(row)
print(lines)
```
%% Output
[['nom', 'prenom', 'surnom'], ['toto', 'd', 'toto'], ['titi', 'a', 'tutu']]
[['nom', 'prenom', 'surnom'], ['toto', 'd', 'toto'], ['titi', 'a', 'tutu'], ['tata', 'plop', 'a']]
%% Cell type:code id: tags:
``` python
print('hello dude')
```
%% Output
hello dude
%% Cell type:code id: tags:
``` python
```
......
......@@ -10,5 +10,9 @@ def get_sample():
return "Col1,Col2,Col3\naaa,bbb,ccc"
def get_last_import_info():
return "No info on last import"
def upload_data(path):
print(path)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment