Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-sapletta-com authored Nov 16, 2023
1 parent 1b0309e commit 915d86d
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions 3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,63 @@ function iteration(DataModel $test_input, DataModel $test_output, $component)
}
```

---

### Python with SQLite
```python
import sqlite3

conn = sqlite3.connect('example.db')
cursor = conn.cursor()

# Execute a query
cursor.execute('SELECT * FROM tablename')

# Commit if it's a write operation
conn.commit()

# Close the connection
conn.close()
```

### Python with MySQL using `mysql-connector-python`
```python
import mysql.connector

cnx = mysql.connector.connect(user='username', password='password',
host='127.0.0.1',
database='mydatabase')

cursor = cnx.cursor()

query = "SELECT * FROM tablename"
cursor.execute(query)

# For write operations
cnx.commit()

cursor.close()
cnx.close()
```

### Python with PostgreSQL using `psycopg2`
```python
import psycopg2

conn = psycopg2.connect("dbname='mydatabase' user='username' host='localhost' password='password'")

cursor = conn.cursor()

cursor.execute("SELECT * FROM tablename")

# For write operations
conn.commit()

cursor.close()
conn.close()
```


----

```php
Expand Down

0 comments on commit 915d86d

Please sign in to comment.