sqlalchemy-seerdb 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {sqlalchemy_seerdb-0.2.0/sqlalchemy_seerdb.egg-info → sqlalchemy_seerdb-0.2.1}/PKG-INFO +21 -4
  2. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/README.md +20 -3
  3. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/pyproject.toml +1 -1
  4. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb/__init__.py +1 -1
  5. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb/seerdb.py +28 -0
  6. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1/sqlalchemy_seerdb.egg-info}/PKG-INFO +21 -4
  7. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/LICENSES/MIT.txt +0 -0
  8. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/setup.cfg +0 -0
  9. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb/provision.py +0 -0
  10. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb/requirements.py +0 -0
  11. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb.egg-info/SOURCES.txt +0 -0
  12. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb.egg-info/dependency_links.txt +0 -0
  13. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb.egg-info/entry_points.txt +0 -0
  14. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb.egg-info/requires.txt +0 -0
  15. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/sqlalchemy_seerdb.egg-info/top_level.txt +0 -0
  16. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/test/test_connect_args.py +0 -0
  17. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/test/test_suite.py +0 -0
  18. {sqlalchemy_seerdb-0.2.0 → sqlalchemy_seerdb-0.2.1}/test/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy-seerdb
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: SQLAlchemy dialect for the seerdb driver
5
5
  Author-email: Peter Lemenkov <lemenkov@gmail.com>
6
6
  License-Expression: MIT
@@ -93,16 +93,33 @@ builds tables there.
93
93
 
94
94
  The test account cannot create it (`ORA-01031`), so run this as a DBA once:
95
95
 
96
+ ```
97
+ python test/prepare_test_schema.py --host localhost --service XE \
98
+ --dba-password <SYSTEM password> --test-user <your test user>
99
+ ```
100
+
101
+ It is safe to rerun: each statement is attempted on its own and one that has
102
+ already been applied is reported and skipped. What it runs, for a DBA who would
103
+ rather type it:
104
+
96
105
  ```sql
106
+ -- the test account's own tables must live in USERS: the Oracle dialect hides
107
+ -- SYSTEM-tablespace tables from reflection, and the suite then never empties
108
+ -- them between tests (rows "survive", ORA-00001)
109
+ ALTER USER <your test user> DEFAULT TABLESPACE USERS;
110
+ ALTER USER <your test user> QUOTA UNLIMITED ON USERS;
111
+
97
112
  CREATE USER test_schema IDENTIFIED BY test_schema;
98
113
  GRANT CREATE SESSION TO test_schema;
99
- ALTER USER test_schema QUOTA UNLIMITED ON USERS;
114
+ ALTER USER test_schema DEFAULT TABLESPACE USERS;
115
+ GRANT UNLIMITED TABLESPACE TO test_schema;
100
116
 
101
- -- so the test account can build and drop the fixtures inside that schema
117
+ -- so the test account can build and drop the fixtures inside that schema;
118
+ -- SELECT ANY SEQUENCE keeps sequences in test_schema visible to reflection
102
119
  GRANT CREATE ANY TABLE, DROP ANY TABLE, SELECT ANY TABLE, INSERT ANY TABLE,
103
120
  UPDATE ANY TABLE, DELETE ANY TABLE, CREATE ANY INDEX, DROP ANY INDEX,
104
121
  CREATE ANY VIEW, DROP ANY VIEW, CREATE ANY SEQUENCE, DROP ANY SEQUENCE,
105
- COMMENT ANY TABLE, ANALYZE ANY TO <your test user>;
122
+ SELECT ANY SEQUENCE, COMMENT ANY TABLE, ANALYZE ANY TO <your test user>;
106
123
  ```
107
124
 
108
125
  Those `ANY` privileges are broad. They are fine on a throwaway test instance —
@@ -71,16 +71,33 @@ builds tables there.
71
71
 
72
72
  The test account cannot create it (`ORA-01031`), so run this as a DBA once:
73
73
 
74
+ ```
75
+ python test/prepare_test_schema.py --host localhost --service XE \
76
+ --dba-password <SYSTEM password> --test-user <your test user>
77
+ ```
78
+
79
+ It is safe to rerun: each statement is attempted on its own and one that has
80
+ already been applied is reported and skipped. What it runs, for a DBA who would
81
+ rather type it:
82
+
74
83
  ```sql
84
+ -- the test account's own tables must live in USERS: the Oracle dialect hides
85
+ -- SYSTEM-tablespace tables from reflection, and the suite then never empties
86
+ -- them between tests (rows "survive", ORA-00001)
87
+ ALTER USER <your test user> DEFAULT TABLESPACE USERS;
88
+ ALTER USER <your test user> QUOTA UNLIMITED ON USERS;
89
+
75
90
  CREATE USER test_schema IDENTIFIED BY test_schema;
76
91
  GRANT CREATE SESSION TO test_schema;
77
- ALTER USER test_schema QUOTA UNLIMITED ON USERS;
92
+ ALTER USER test_schema DEFAULT TABLESPACE USERS;
93
+ GRANT UNLIMITED TABLESPACE TO test_schema;
78
94
 
79
- -- so the test account can build and drop the fixtures inside that schema
95
+ -- so the test account can build and drop the fixtures inside that schema;
96
+ -- SELECT ANY SEQUENCE keeps sequences in test_schema visible to reflection
80
97
  GRANT CREATE ANY TABLE, DROP ANY TABLE, SELECT ANY TABLE, INSERT ANY TABLE,
81
98
  UPDATE ANY TABLE, DELETE ANY TABLE, CREATE ANY INDEX, DROP ANY INDEX,
82
99
  CREATE ANY VIEW, DROP ANY VIEW, CREATE ANY SEQUENCE, DROP ANY SEQUENCE,
83
- COMMENT ANY TABLE, ANALYZE ANY TO <your test user>;
100
+ SELECT ANY SEQUENCE, COMMENT ANY TABLE, ANALYZE ANY TO <your test user>;
84
101
  ```
85
102
 
86
103
  Those `ANY` privileges are broad. They are fine on a throwaway test instance —
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "sqlalchemy-seerdb"
10
- version = "0.2.0"
10
+ version = "0.2.1"
11
11
  description = "SQLAlchemy dialect for the seerdb driver"
12
12
  readme = "README.md"
13
13
  license = "MIT"
@@ -19,4 +19,4 @@ from sqlalchemy_seerdb.seerdb import SeerdbDialect
19
19
 
20
20
  __all__ = ['SeerdbDialect', '__version__']
21
21
 
22
- __version__ = '0.2.0'
22
+ __version__ = '0.2.1'
@@ -238,6 +238,23 @@ class SeerdbCompiler(OracleCompiler):
238
238
  return super().bindparam_string(name, **kw)
239
239
 
240
240
 
241
+ def _driver_has_fetch_lobs() -> bool:
242
+ """Whether the installed driver understands ``fetch_lobs``.
243
+
244
+ It arrived in seerdb 3.0 together with the LOB object; passing it to an
245
+ older driver is a TypeError, and this dialect supports both."""
246
+ import inspect
247
+
248
+ try:
249
+ params = inspect.signature(seerdb.OracleConnect.__init__).parameters
250
+ except (AttributeError, TypeError, ValueError):
251
+ return False
252
+ return 'fetch_lobs' in params
253
+
254
+
255
+ _DRIVER_HAS_FETCH_LOBS = _driver_has_fetch_lobs()
256
+
257
+
241
258
  class SeerdbDialect(OracleDialect):
242
259
  """SQLAlchemy dialect driving the seerdb DBAPI."""
243
260
 
@@ -347,6 +364,17 @@ class SeerdbDialect(OracleDialect):
347
364
  # DBAPI contract SQLAlchemy builds on is autocommit off, so that is the
348
365
  # default here; ``?autocommit=true`` in the URL still turns it on.
349
366
  options['autocommit'] = False
367
+ # SQLAlchemy's type machinery expects a CLOB / BLOB column to arrive as
368
+ # str / bytes -- its Text and LargeBinary result processors, and every
369
+ # comparison the compliance suite makes, are written against values.
370
+ # seerdb 3.0 returns a LOB OBJECT by default instead (matching
371
+ # python-oracledb), so ask for the values this dialect is built on.
372
+ #
373
+ # Feature-detected rather than pinned: the same dialect still has to
374
+ # work against a driver that predates the option, and its floor cannot
375
+ # be raised to a release that is not published yet.
376
+ if _DRIVER_HAS_FETCH_LOBS:
377
+ options['fetch_lobs'] = False
350
378
  for key, value in url.query.items():
351
379
  # A repeated key arrives as a tuple; the driver takes one value.
352
380
  options[key] = _coerce(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy-seerdb
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: SQLAlchemy dialect for the seerdb driver
5
5
  Author-email: Peter Lemenkov <lemenkov@gmail.com>
6
6
  License-Expression: MIT
@@ -93,16 +93,33 @@ builds tables there.
93
93
 
94
94
  The test account cannot create it (`ORA-01031`), so run this as a DBA once:
95
95
 
96
+ ```
97
+ python test/prepare_test_schema.py --host localhost --service XE \
98
+ --dba-password <SYSTEM password> --test-user <your test user>
99
+ ```
100
+
101
+ It is safe to rerun: each statement is attempted on its own and one that has
102
+ already been applied is reported and skipped. What it runs, for a DBA who would
103
+ rather type it:
104
+
96
105
  ```sql
106
+ -- the test account's own tables must live in USERS: the Oracle dialect hides
107
+ -- SYSTEM-tablespace tables from reflection, and the suite then never empties
108
+ -- them between tests (rows "survive", ORA-00001)
109
+ ALTER USER <your test user> DEFAULT TABLESPACE USERS;
110
+ ALTER USER <your test user> QUOTA UNLIMITED ON USERS;
111
+
97
112
  CREATE USER test_schema IDENTIFIED BY test_schema;
98
113
  GRANT CREATE SESSION TO test_schema;
99
- ALTER USER test_schema QUOTA UNLIMITED ON USERS;
114
+ ALTER USER test_schema DEFAULT TABLESPACE USERS;
115
+ GRANT UNLIMITED TABLESPACE TO test_schema;
100
116
 
101
- -- so the test account can build and drop the fixtures inside that schema
117
+ -- so the test account can build and drop the fixtures inside that schema;
118
+ -- SELECT ANY SEQUENCE keeps sequences in test_schema visible to reflection
102
119
  GRANT CREATE ANY TABLE, DROP ANY TABLE, SELECT ANY TABLE, INSERT ANY TABLE,
103
120
  UPDATE ANY TABLE, DELETE ANY TABLE, CREATE ANY INDEX, DROP ANY INDEX,
104
121
  CREATE ANY VIEW, DROP ANY VIEW, CREATE ANY SEQUENCE, DROP ANY SEQUENCE,
105
- COMMENT ANY TABLE, ANALYZE ANY TO <your test user>;
122
+ SELECT ANY SEQUENCE, COMMENT ANY TABLE, ANALYZE ANY TO <your test user>;
106
123
  ```
107
124
 
108
125
  Those `ANY` privileges are broad. They are fine on a throwaway test instance —