Skip to content

Commit 30b1147

Browse files
authored
Update README.md
1 parent bb5de6f commit 30b1147

File tree

1 file changed

+118
-24
lines changed

1 file changed

+118
-24
lines changed

README.md

Lines changed: 118 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,129 @@
1-
# InterBase Driver for Python, supporting 32-bit and 64-bit
1+
# InterBase Driver for Python
22

3-
[InterBase Documentation](https://docwiki.embarcadero.com/InterBase/2020/en/Main_Page) \*
4-
[InterBase Source](https://github.com/Embarcadero/InterBasePython) \*
5-
[Based On FDB](http://www.firebirdsql.org/en/devel-python-driver/)
3+
<a href="https://www.embarcadero.com/br/products/interbase"><img alt="InterBase" src="https://d2ohlsp9gwqc7h.cloudfront.net/images/logos/logo-page/ib-logo-1024.png" align="right" width="250"></a>
64

7-
Changes implemented are based on this blog post
5+
> A powerful, [PEP-249-compliant](https://peps.python.org/pep-0249/) Python driver for **InterBase**, supporting both 32-bit and 64-bit.
86
9-
InterBase Driver for Python is a [Python](http://python.org) library package that implements
10-
[Python Database API 2.0](http://www.python.org/dev/peps/pep-0249/)-compliant support for the Embarcadero SQL Database
11-
[InterBase](https://interbase.com/) ®. In addition to the minimal
12-
feature set of the standard Python DB API, InterBase Driver for Python also exposes the entire
13-
native (old-style) client API of the database engine. Notably:
7+
The **InterBase Driver for Python** is based on the [FDB driver](http://www.firebirdsql.org/en/devel-python-driver/) and provides access to the [InterBase](https://interbase.com/) RDBMS using a robust and flexible Python interface. This package supports the **Python Database API 2.0** standard (PEP-249) while offering extended access to the native InterBase API.
148

15-
- Automatic data conversion from strings on input.
16-
- Automatic input/output conversions of textual data between UNICODE
17-
and database character sets.
18-
- Support for prepared SQL statements.
19-
- Multiple independent transactions per single connection.
20-
access specifications.
21-
- Distributed transactions.
9+
📚 [InterBase Documentation](https://docwiki.embarcadero.com/InterBase/2020/en/Main_Page)
10+
🔗 [GitHub Source Code](https://github.com/Embarcadero/InterBasePython)
2211

23-
Install (32-bit or 64-bit version of python 3.* required)
12+
---
2413

25-
You can use one of the following ways to do it.
14+
## ✨ Features
2615

27-
`pip install interbase`
16+
- PEP-249 compliance
17+
- Full Unicode and character set support
18+
- Native API access
19+
- Multiple independent transactions per connection
20+
- Distributed transaction support
21+
- Automatic conversion of textual data
22+
- Prepared statement support
2823

29-
`pip install git+https://github.com/Embarcadero/InterBasePython.git`
24+
---
3025

31-
`pip install git+ssh://git@github.com/Embarcadero/InterBasePython.git`
26+
## 📦 Installation
3227

33-
To create a test DB:
28+
> Requires Python 3.x (32-bit or 64-bit version to match InterBase client).
3429
35-
`cd test/files && isql -i create-test-db.sql`
30+
Install via PyPI:
31+
```bash
32+
pip install interbase
33+
```
34+
35+
Or install from the GitHub repository:
36+
```bash
37+
pip install git+https://github.com/Embarcadero/InterBasePython.git
38+
# or via SSH:
39+
pip install git+ssh://git@github.com/Embarcadero/InterBasePython.git
40+
```
41+
42+
---
43+
44+
## 🧪 Setting Up a Test Database
45+
46+
```bash
47+
cd test/files
48+
isql -i create-test-db.sql
49+
```
50+
51+
---
52+
53+
## 🔌 Sample Usage
54+
55+
### Basic Connection
56+
```python
57+
import interbase
58+
59+
con = interbase.connect(
60+
host=IBTEST_HOST, # Hostname or IP address of the InterBase server
61+
database=IBTEST_DB_PATH, # Path to the database file on the server
62+
user=IBTEST_USER, # Username for authentication
63+
password=IBTEST_PASSWORD, # Password for authentication
64+
sql_dialect=IBTEST_SQL_DIALECT, # SQL dialect to use (usually 1 or 3)
65+
ssl=IBTEST_SERVER_PUBLIC_FILE is not None, # Enable SSL if a public server key is provided
66+
server_public_file=IBTEST_SERVER_PUBLIC_FILE # Path to the server's public SSL key file (if SSL is enabled)
67+
)
68+
```
69+
70+
### Executing a Query
71+
```python
72+
cur = con.cursor()
73+
cur.execute("SELECT * FROM employees")
74+
for row in cur:
75+
print(row)
76+
```
77+
78+
### Using Parameters
79+
```python
80+
cur.execute("INSERT INTO employees(name, age) VALUES (?, ?)", ("John Doe", 34))
81+
con.commit()
82+
```
83+
84+
### Handling Transactions
85+
86+
#### Manual Transaction Control
87+
```python
88+
transaction = con.main_transaction
89+
transaction.begin()
90+
91+
cursor = transaction.cursor()
92+
cursor.execute("INSERT INTO t (c1) VALUES (1)")
93+
transaction.commit()
94+
```
95+
96+
#### Using a Context Manager
97+
```python
98+
import interbase
99+
100+
with interbase.TransactionContext(con) as tr:
101+
cursor = tr.cursor()
102+
cursor.execute("INSERT INTO t (c1) VALUES (1)")
103+
# The transaction is automatically committed when the block ends.
104+
```
105+
106+
---
107+
108+
## 🧰 More Examples
109+
Explore the `test` folder in the [GitHub Repository](https://github.com/Embarcadero/InterBasePython) for full coverage of features, including:
110+
111+
- Working with BLOBs
112+
- Using metadata APIs
113+
- Working with stored procedures
114+
- SSL support
115+
- Error handling
116+
117+
---
118+
119+
## 🤝 Contributing
120+
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
121+
122+
---
123+
124+
## 📜 License
125+
This project is licensed under the Embarcadero license terms.
126+
127+
---
128+
129+
> 🔗 Stay up to date with the latest changes and enhancements to InterBase by following the official [Embarcadero Blog](https://blogs.embarcadero.com/).

0 commit comments

Comments
 (0)