Skip to content

Commit 2cb5945

Browse files
committed
Release 0.6.0
1 parent 0786bec commit 2cb5945

25 files changed

+5135
-3456
lines changed

docs/changelog.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22
Changelog
33
#########
44

5+
Version 0.6.0
6+
=============
7+
8+
* More documentation.
9+
* Initial support for Firebird 4+ (interfaces and other definitions). Includes support for
10+
interface versions.
11+
* `Service` renamed to `Server`. Selected functionality moved to inner objects (relates to
12+
FB4+ support).
13+
* New module: `~firebird.driver.config` - Driver configuration
14+
* New module: `~firebird.driver.interfaces` - Interface wrappers for Firebird new API
15+
* Changed module: `~firebird.driver.types`
16+
17+
- Interface wrapper moved to separate module
18+
- Buffer managers moved to `~firebird.driver.core` module
19+
* Changed module: `~firebird.driver.core`
20+
21+
- `connect()`, `create_database()` and `connect_server()` now use driver configuration.
22+
- Simplified/unified transaction isolation specification.
23+
- Emit warnings when objects with allocated Firebird resources are disposed (by Python
24+
GC) without prior call to `close()`.
25+
- Trace instrumentation removed. Use dynamic trace configuration from firebird-base 0.6.0.
26+
- `Connection` and `Transaction` information moved to inner objects accesible via `info`
27+
properties (relates to FB4+ support).
528

629
Version 0.5.0
730
=============

docs/conf.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
author = 'Pavel Císař'
2424

2525
# The short X.Y version
26-
version = '0.5.0'
26+
version = '0.6.0'
2727

2828
# The full version, including alpha/beta/rc tags
29-
release = '0.5.0'
29+
release = '0.6.0'
3030

3131

3232
# -- General configuration ---------------------------------------------------
@@ -54,7 +54,7 @@
5454
# List of patterns, relative to source directory, that match files and
5555
# directories to ignore when looking for source files.
5656
# This pattern also affects html_static_path and html_extra_path.
57-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
57+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'requirements.txt']
5858

5959
default_role = 'py:obj'
6060

@@ -97,7 +97,7 @@
9797
],
9898

9999
# Render the next and previous page links in navbar. (Default: true)
100-
#'navbar_sidebarrel': True,
100+
'navbar_sidebarrel': False,
101101

102102
# Render the current pages TOC in the navbar. (Default: true)
103103
#'navbar_pagenav': True,
@@ -183,8 +183,9 @@
183183

184184
# -- Options for intersphinx extension ---------------------------------------
185185

186-
# Example configuration for intersphinx: refer to the Python standard library.
187-
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
186+
# intersphinx
187+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
188+
'base': ('https://firebird-base.rtfd.io/en/latest', None)}
188189

189190
# -- Options for todo extension ----------------------------------------------
190191

docs/getting-started.txt

Lines changed: 66 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ Run pip::
2020

2121
$ pip install firebird-driver
2222

23-
2423
.. _setuptools: https://pypi.org/project/setuptools/
2524
.. _PYPI: https://pypi.org/
2625
.. _ctypes: http://docs.python.org/library/ctypes.html
2726
.. _pip: https://pypi.org/project/pip/
28-
27+
.. _firebird-base: https://firebird-base.rtfd.io
2928

3029
Quick-start Guide
3130
*****************
@@ -37,49 +36,90 @@ comprehensive in its coverage of anything else.
3736
The numerous advanced features of Firebird-driver are covered in another section of this
3837
documentation, which is not in a tutorial format, though it is replete with examples.
3938

39+
Driver configuration
40+
====================
41+
42+
The driver uses configuration built on top of `configuration system <firebird.base.config>`
43+
provided by `firebird-base`_ package. In addition to global settings, the configuration
44+
also includes the definition of connection parameters to Firebird servers and databases.
45+
46+
The default configuration connects to embedded server using direct/local connection method.
47+
To access remote servers and databases (or local ones through remote protocols), it's
48+
neccessary to adjust default configuration, or `register` them in configuration manager.
49+
50+
You can manipulate the configuration objects directly, or load configuration from files or
51+
strings (in `.ini-style` `ConfigParser` format).
4052

4153
Connecting to a Database
4254
========================
4355

56+
**Example 1:**
4457

45-
**Example 1**
46-
47-
A database connection is typically established with code such as this:
58+
A simple database connection is typically established with code such as this:
4859

4960
.. sourcecode:: python
5061

5162
from firebird.driver import connect
5263

53-
# The server is named 'bison'; the database file is at '/temp/test.db'.
54-
con = connect(dsn='bison:/temp/test.db', user='sysdba', password='pass')
64+
# Attach to 'employee' database/alias using embedded server connection
65+
con = connect('employee', user='sysdba', password='masterkey')
5566

56-
# Or, equivalently:
57-
con = connect(host='bison', database='/temp/test.db',
58-
user='sysdba', password='pass')
67+
# Attach to 'employee' database/alias using local server connection
68+
from firebird.driver import driver_config
69+
driver_config.server_defaults.host.value = 'localhost'
70+
con = connect('employee', user='sysdba', password='masterkey')
5971

72+
# Set 'user' and 'password' via configuration
73+
driver_config.server_defaults.user.value = 'SYSDBA'
74+
driver_config.server_defaults.password.value = 'masterkey'
75+
con = connect('employee')
6076

61-
**Example 2**
77+
**Example 2:**
6278

63-
Suppose we want to connect to the database in SQL Dialect 1 and specifying
64-
UTF-8 as the character set of the connection:
79+
A database connection typically uses specific configuration, and is established with code
80+
such as this:
6581

6682
.. sourcecode:: python
6783

68-
from firebird.driver import connect
84+
from firebird.driver import connect, driver_config
6985

70-
con = connect(
71-
dsn='bison:/temp/test.db',
72-
user='sysdba', password='pass',
73-
dialect=1, # necessary for all dialect 1 databases
74-
charset='UTF8' # specify a character set for the connection
75-
)
86+
# Register Firebird server
87+
srv_cfg = """[local]
88+
host = localhost
89+
user = SYSDBA
90+
password = masterkey
91+
"""
92+
driver_config.register_server('local', srv_cfg)
93+
94+
# Register database
95+
db_cfg = """[employee]
96+
server = local
97+
database = employee.fdb
98+
protocol = inet
99+
charset = utf8
100+
"""
101+
driver_config.register_database('employee', db_cfg)
76102

103+
# Attach to 'employee' database
104+
con = connect('employee')
105+
106+
.. note::
107+
108+
Some parameters like 'user' and 'password' could be overriden with keyword parameters.
109+
Few parameters like 'crypt_callback' or 'no_db_triggers' could be specified **ONLY**
110+
as keyword arguments.
111+
112+
Creating a Database
113+
===================
114+
115+
A database is created using `~firebird.driver.core.create_database()` function.
116+
Like `~firebird.driver.core.connect()`, this function uses configuration for specification of
117+
database parameters like page size, sweep interval etc.
77118

78119
Executing SQL Statements
79120
========================
80121

81-
For this section, suppose we have a table defined and populated by the
82-
following SQL code:
122+
For this section, suppose we have a table defined and populated by the following SQL code:
83123

84124
.. sourcecode:: sql
85125

@@ -92,7 +132,6 @@ following SQL code:
92132
insert into languages (name, year_released) values ('C', 1972);
93133
insert into languages (name, year_released) values ('Python', 1991);
94134

95-
96135
**Example 1**
97136

98137
This example shows the *simplest* way to print the entire contents of
@@ -102,7 +141,7 @@ the `languages` table:
102141

103142
from firebird.driver import connect
104143

105-
con = connect(database='/temp/test.db', user='sysdba', password='masterkey')
144+
con = connect('test.fdb', user='sysdba', password='masterkey')
106145

107146
# Create a Cursor object that operates in the context of Connection con:
108147
cur = con.cursor()
@@ -113,14 +152,12 @@ the `languages` table:
113152
# Retrieve all rows as a sequence and print that sequence:
114153
print(cur.fetchall())
115154

116-
117155
Sample output:
118156

119157
.. sourcecode:: python
120158

121159
[('C', 1972), ('Python', 1991)]
122160

123-
124161
**Example 2**
125162

126163
Here's another trivial example that demonstrates various ways of fetching a single row at a time from a `SELECT`-cursor:
@@ -129,7 +166,7 @@ Here's another trivial example that demonstrates various ways of fetching a sing
129166

130167
from firebird.driver import connect
131168

132-
con = connect(dsn='/temp/test.db', user='sysdba', password='masterkey')
169+
con = connect('test.fdb', user='sysdba', password='masterkey')
133170

134171
cur = con.cursor()
135172
SELECT = "select name, year_released from languages order by year_released"
@@ -145,8 +182,6 @@ Here's another trivial example that demonstrates various ways of fetching a sing
145182
for row in cur:
146183
print(f'{row[0]} has been publicly available since {row[1]}.')
147184

148-
149-
150185
Sample output:
151186

152187
.. sourcecode:: python
@@ -158,7 +193,6 @@ Sample output:
158193
C has been publicly available since 1972.
159194
Python has been publicly available since 1991.
160195

161-
162196
**Example 3**
163197

164198
The following program is a simplistic table printer (applied in this example to `languages`):
@@ -170,7 +204,7 @@ The following program is a simplistic table printer (applied in this example to
170204
TABLE_NAME = 'languages'
171205
SELECT = f'select * from {TABLE_NAME} order by year_released'
172206

173-
con = connect(dsn='/temp/test.db', user='sysdba', password='masterkey')
207+
con = connect('test.fdb', user='sysdba', password='masterkey')
174208

175209
cur = con.cursor()
176210
cur.execute(SELECT)
@@ -212,7 +246,7 @@ Let's insert more languages:
212246

213247
from firebird.driver import connect
214248

215-
con = connect(dsn='/temp/test.db', user='sysdba', password='masterkey')
249+
con = connect('test.fdb', user='sysdba', password='masterkey')
216250

217251
cur = con.cursor()
218252

docs/index.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Content
2020
*******
2121

2222
.. toctree::
23-
:maxdepth: 1
23+
:maxdepth: 2
2424
:caption: Contents:
2525

2626
getting-started

docs/ref-config.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. module:: firebird.driver.config
2+
:synopsis: Driver configuration
3+
4+
======================
5+
firebird.driver.config
6+
======================
7+
8+
This module contains firebird-driver configuration. Uses configuration classes from firebird-base
9+
package.
10+
11+
Classes
12+
=======
13+
14+
DriverConfig
15+
------------
16+
.. autoclass:: DriverConfig
17+
18+
ServerConfig
19+
------------
20+
.. autoclass:: ServerConfig
21+
22+
DatabaseConfig
23+
--------------
24+
.. autoclass:: DatabaseConfig
25+
26+
Globals
27+
=======
28+
29+
driver_config
30+
-------------
31+
.. autodata:: driver_config

0 commit comments

Comments
 (0)