Giter Club home page Giter Club logo

sqlalchemy-firebird's Issues

caching warning from SQLAlchemy 1.4

Describe the bug
A clear and concise description of what the bug is.
Since upgrading to SQLAlchemy 1.4, it outputs the following warning when using sqlalchemy-firebird:

SAWarning: Dialect firebird:fdb will not make use of SQL compilation caching as it does not set the 'supports_statement_cache' attribute to ``True``.  This can have significant performance implications including some performance degradations in comparison to prior SQLAlchemy versions.  Dialect maintainers should seek to set this attribute to True after appropriate development and testing for SQLAlchemy 1.4 caching support.   Alternatively, this attribute may be set to False which will disable this warning. (Background on this error at: https://sqlalche.me/e/14/cprf)

To Reproduce

import sys
import flask
import os
import os.path
from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)

app.config.setdefault('DB_PATH', os.getcwd())
app.config.setdefault('SESSION_DB_HOST', 'localhost')
app.config.setdefault('SESSION_DB', 'db/sessions.fdb')
app.config.setdefault('FIREBIRD_USER', 'sysdba')
app.config.setdefault('FIREBIRD_PASSWORD', 'masterkey')

app.config.setdefault('SQLALCHEMY_DATABASE_URI', 'firebird+fdb://%s:%s@%s/%s'
                      % (app.config['FIREBIRD_USER'],
                         app.config['FIREBIRD_PASSWORD'],
                          app.config['SESSION_DB_HOST'],
                          os.path.join(app.config['DB_PATH'], app.config['SESSION_DB'])))

session_db = SQLAlchemy()
session_db.init_app(app)

with app.app_context():
    # session_db.engine.echo = True
    session_db.metadata.bind = session_db.engine
    session_db.metadata.reflect()

Pandas `read_sql()` does not preserve the correct case of column names.

Describe the bug

Pandas read_sql() (which uses SQLAlchemy) does not preserve the correct case of column names.

To Reproduce

import sqlalchemy as sa
import pandas as pd

e = sa.create_engine(db_uri)
with e.connect() as conn:
    q = 'SELECT 1 one, 2 TWO, 3 "three", 4 "FOUR", 5 "Five" from rdb$database'
    r = conn.exec_driver_sql(q)
    print([x for x, *rest in r.cursor.description])
    # ['ONE', 'TWO', 'three', 'FOUR', 'Five']

    df = pd.read_sql(sql=q, con=db_uri, dtype_backend="pyarrow")
    print(df.columns)
    # Index(['one', 'two', 'three', 'four', 'Five'], dtype='object')

Expected behavior

    print(df.columns)
    # Index(['ONE', 'TWO', 'three', 'FOUR', 'Five'], dtype='object')

Columns should reflect the exact same name from cursor.description.

SqlAlchemy 2.0. multiple sessions

Hi,
I have a problem with session.commit() when I connect from multiple sources (in my case processes).
I use docker firebird https://hub.docker.com/r/jacobalberty/firebird, but it should not be a problem (I hope).

I use this code to add new data row to table:

with Session(engine) as session:
    try:
        session.add(Model)
    except:
        session.rollback()
        raise
    else:
        session.commit()

If I use only one process no problem. When I start more processes, they probably create more session the same time and commit the same time and that's the problem.

I have no idea it this is problem of firebird, fdb or sqlalchemy-firebird.

Do you have any suggestion? Do I use it wrong way?

Thanks a lot.
Tomas

SqlAlchemy handling of firebird stream blobs (a.k.a. BlobReader objects)

I'm having a problem reading large blobs from a firebird database, using the new firebird-driver.

For large blobs, the firebird driver (both new and old) returns BlobReader objects, rather than the fully materialised python bytes-objects. These BlobReader objects are file-like and can be read to obtain the binary data. The thing that has changed in the new firebird driver is that the Cursor.close() method now closes all BlobReader objects associated with that cursor. Unfortunately, when sqlalchemy executes a statement returning data (i.e. calls fetchXXX() on the cursor), it always closes the cursor after iterating over it, but before accessing any of the data in the returned rows. Hence, later on when the data is passed to the Dialect TypeDecorator to handle type-conversions, the cursor has been closed so all the BlobReader objects are closed, so reading the data fails.

Although I can't see a way to fix this in the Dialect, I'm wondering if you have any ideas, before I look at modifying the sqlalchemy core to add some sort of hook to customise Cursor closing behaviour.
The author of the new firebird driver seems adamant that the BlobReaders ought to be closed when the Cursor is closed.

SQLAlchemy 2.0 support status?

SQLAlchemy 2.0 was officially released in january

With this release, the default version of SQLAlchemy that will install when one runs pip install sqlalchemy will be version 2.0.

I'm looking to migrate some production projects from SQLAlchemy 1.4 to 2.0.

But I'm wondering will this project in its current state support it?

I'm asking because I didn't see any commits related to 2.0 compatibility. And there are significant changes in SQLAlchemy 2.0.

Support for embedded database?

Does this support the embedded firebird database? Access the fdb file without a running server just using the fbclient.dll.

Or do I need to have a Firebird server running?

Reflection of computed column

I've seen that this is replacing the internal firebird dialect in sqlalchemy.

I'm adding support for reflecting computed columns in sqlalchemy/sqlalchemy#5064.
Should the support be added in that pr also for firebird, or should a new pr be made here?

need add pckage

Describe the bug
ModuleNotFoundError: No module named 'packaging'

To Reproduce
Steps to reproduce the behavior:
Create new project =)

Add Firebird 4 support

Hi, seems to miss support for Firebird 4, see the error message below.
Is there a temporary way to solve the issue?

self = <sqlalchemy_firebird.fdb.FBDialect_fdb object at 0x7fa6949d6160>
version = 'LI-T4.0.0.1963 Firebird 4.0 Beta 2'

    def _parse_version_info(self, version):
        m = match(
            r"\w+-V(\d+)\.(\d+)\.(\d+)\.(\d+)( \w+ (\d+)\.(\d+))?", version
        )
        if not m:
>           raise AssertionError(
                "Could not determine version from string '%s'" % version
            )
E           AssertionError: Could not determine version from string 'LI-T4.0.0.1963 Firebird 4.0 Beta 2'

env/lib/python3.8/site-packages/sqlalchemy_firebird/kinterbasdb.py:175: AssertionError

Versions.

  • OS: Ubuntu 20.04.2 LTS
  • Python: 3.8.10
  • sqlalchemy_firebird 0.7.0
  • SQLAlchemy: 1.4.20
  • Database: Firebird 4.0
  • DBAPI:

Circular import

From what I understood to use sqlalchemy_firebird we need to import both like this:

import sqlalchemy
import sqlalchemy_firebird

The problem comes when the script is bundled with PyInstaller:

[main ≡ +0 ~3 -0 !]› .\dist\test.exe
Traceback (most recent call last):
  File "test_folder\test.py", line 4, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "sqlalchemy_firebird\__init__.py", line 23, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "sqlalchemy_firebird\provision.py", line 1, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "sqlalchemy\testing\__init__.py", line 12, in <module>
ImportError: cannot import name 'config' from partially initialized module 'sqlalchemy.testing' (most likely due to a circular import) (C:\Users\lucas\AppData\Local\Temp\_MEI77922\sqlalchemy\testing\__init__.pyc)
[23588] Failed to execute script 'test' due to unhandled exception!

The bundling operation in itself works, but the problem arises when the executable is launched.

Am i importing/using it wrong?

The documentation does not include an example code.

is it right description ?

Describe the bug
is it right ?

  # Use the fdb driver (Python 3.6/3.7)
  firebird+fdb://username:password@localhost///home/testuser/projects/databases/my_project.fdb 
  # Use the firebird-driver driver (Python 3.8+)
  firebird+firebird://username:password@localhost///home/testuser/projects/databases/my_project.fdb

i use Python 3.10 and it work with firebird+fdb but i get error with firebird+firebird


  File "//venv3.10/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 637, in connect
    return dialect.connect(*cargs, **cparams)
  File "//venv3.10/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 616, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
TypeError: connect() got an unexpected keyword argument 'host'

support multiple Firebird ports on same host

I have two different Firebird servers running on the same host, on different ports. This is so that I can migrate from the old version to the new on a database by database basis. This works fine with sqlalchemy using fdb.

Looking at https://github.com/pauldex/sqlalchemy-firebird/blob/main/sqlalchemy_firebird/firebird.py#L68 , this module assumes that there will only be one Firebird port on the host and updates the host registration with the latest connection port.

Could it instead register each host+port combination individually?

Tip: Confirm that this dialect is being used in SQLAlchemy 1.3.17+

SQLAlchemy 1.3.17 added the hook to load this dialect if it is installed, otherwise fall back to the internal dialect. An easy way to confirm which dialect is actually being used is to execute

print(engine.dialect.get_table_names(engine.connect()))

This dialect will correctly return the table names, trimmed and case-normalized:

['table1', ...

while the internal dialect will return the raw table names from rdb$relations:

['TABLE1                         ', ...

Embedded connection error

Hi,
I'm trying to establish an embedded connection to a database.
However, it's reporting an error.
engine = create_engine("firebird://sysdba@/C:/temp/MY_PROJECT.FDB?charset=UTF8")
engine.connect()
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 145, in init
self._dbapi_connection = engine.raw_connection()
File "C:\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 3293, in raw_connection
return self.pool.connect()
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 452, in connect
return _ConnectionFairy._checkout(self)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 1268, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 716, in checkout
rec = pool._do_get()
File "C:\Python310\lib\site-packages\sqlalchemy\pool\impl.py", line 168, in _do_get
with util.safe_reraise():
File "C:\Python310\lib\site-packages\sqlalchemy\util\langhelpers.py", line 147, in exit
raise exc_value.with_traceback(exc_tb)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\impl.py", line 166, in _do_get
return self._create_connection()
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 393, in _create_connection
return _ConnectionRecord(self)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 678, in init
self.__connect()
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 902, in __connect
with util.safe_reraise():
File "C:\Python310\lib\site-packages\sqlalchemy\util\langhelpers.py", line 147, in exit
raise exc_value.with_traceback(exc_tb)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 898, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
File "C:\Python310\lib\site-packages\sqlalchemy\engine\create.py", line 637, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Python310\lib\site-packages\sqlalchemy\engine\default.py", line 616, in connect
return self.loaded_dbapi.connect(*cargs, **cparams)
File "C:\Python310\lib\site-packages\firebird\driver\core.py", line 2128, in connect
return __make_connection(False, dsn, db_config.utf8filename.value, dpb.get_buffer(),
File "C:\Python310\lib\site-packages\firebird\driver\core.py", line 2044, in __make_connection
att = provider.attach_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
File "C:\Python310\lib\site-packages\firebird\driver\interfaces.py", line 1283, in attach_database
self._check()
File "C:\Python310\lib\site-packages\firebird\driver\interfaces.py", line 111, in _check
raise self.__report(DatabaseError, self.status.get_errors())
firebird.driver.types.DatabaseError: Unable to complete network request to host "xnet://Global\FIREBIRD".
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2022.3.2\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
coro = func()
File "", line 1, in
File "C:\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 3269, in connect
return self._connection_cls(self)
File "C:\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 147, in init
Connection._handle_dbapi_exception_noconnection(
File "C:\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 2431, in _handle_dbapi_exception_noconnection
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "C:\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 145, in init
self._dbapi_connection = engine.raw_connection()
File "C:\Python310\lib\site-packages\sqlalchemy\engine\base.py", line 3293, in raw_connection
return self.pool.connect()
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 452, in connect
return _ConnectionFairy._checkout(self)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 1268, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 716, in checkout
rec = pool._do_get()
File "C:\Python310\lib\site-packages\sqlalchemy\pool\impl.py", line 168, in _do_get
with util.safe_reraise():
File "C:\Python310\lib\site-packages\sqlalchemy\util\langhelpers.py", line 147, in exit
raise exc_value.with_traceback(exc_tb)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\impl.py", line 166, in _do_get
return self._create_connection()
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 393, in _create_connection
return _ConnectionRecord(self)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 678, in init
self.__connect()
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 902, in __connect
with util.safe_reraise():
File "C:\Python310\lib\site-packages\sqlalchemy\util\langhelpers.py", line 147, in exit
raise exc_value.with_traceback(exc_tb)
File "C:\Python310\lib\site-packages\sqlalchemy\pool\base.py", line 898, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
File "C:\Python310\lib\site-packages\sqlalchemy\engine\create.py", line 637, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Python310\lib\site-packages\sqlalchemy\engine\default.py", line 616, in connect
return self.loaded_dbapi.connect(*cargs, **cparams)
File "C:\Python310\lib\site-packages\firebird\driver\core.py", line 2128, in connect
return __make_connection(False, dsn, db_config.utf8filename.value, dpb.get_buffer(),
File "C:\Python310\lib\site-packages\firebird\driver\core.py", line 2044, in __make_connection
att = provider.attach_database(dsn, dpb, 'utf-8' if utf8filename else FS_ENCODING)
File "C:\Python310\lib\site-packages\firebird\driver\interfaces.py", line 1283, in attach_database
self._check()
File "C:\Python310\lib\site-packages\firebird\driver\interfaces.py", line 111, in _check
raise self.__report(DatabaseError, self.status.get_errors())
sqlalchemy.exc.DatabaseError: (firebird.driver.types.DatabaseError) Unable to complete network request to host "xnet://Global\FIREBIRD".
(Background on this error at: https://sqlalche.me/e/20/4xp6)

is_disconnect() doesn't trigger when using FDB

The bug
Using FDB, when a connection is manually removed from the MON$ATTACHMENTS table and the dialect gets a "connection shutdown" exception, it doesn't get detected by is_disconnect(), because the if isinstance(e, (...)) check fails, and the connection doesn't get recycled.

To Reproduce

  1. Connect to a Firebird database with SQLAlchemy and execute a query.
  2. Remove the connection from the MON$ATTACHMENTS system table.
  3. Execute 2 more queries with the same engine.

Expected behavior
The first query in step 3 fails, but the connection is recycled and so the second query succeeds.

Actual behaviour
The connection is not recycled and both queries fail to execute.

"ReferenceError: weakly-referenced object no longer exists" in Pandas read_sql()

Describe the bug
Using read_sql() from Pandas with the latests sqlalchemy-firebird raises errors which doesn't occur when using read_sql_query().

To Reproduce

import fdb
import pandas as pd
import sqlalchemy as sa

# Windows 10 x64
# Python 3.9.6
# Firebird version 3.0.7 running official Win64 build.
# sqlalchemy-firebird from 'pip install sqlalchemy-firebird'

print(pd.__version__)  # 1.3.0
print(sa.__version__)  # 1.4.25
print(fdb.__version__)  # 2.0.1

fbEngine = sa.create_engine(
    "firebird://sysdba:masterkey@localhost/C:/Program Files/Firebird/Firebird_3_0/examples/empbuild/EMPLOYEE.FDB?charset=UTF8",
    echo=True,
)

basesSql = """
SELECT
  1 "IntField",
  'Some words' "TextField",
  CURRENT_TIMESTAMP "UpdatedAt"
FROM
  mon$database
"""

with fbEngine.connect() as fbConn:
    bases = pd.read_sql_query(basesSql, fbConn)
    print(bases)

Expected behavior

1.3.0
1.4.25
2.0.1
2021-09-28 15:00:56,189 INFO sqlalchemy.engine.Engine
SELECT
  1 "IntField",
  'Some words' "TextField",
  CURRENT_TIMESTAMP "UpdatedAt"
FROM
  mon$database

2021-09-28 15:00:56,189 INFO sqlalchemy.engine.Engine [raw sql] ()
   IntField   TextField               UpdatedAt
0         1  Some words 2021-09-28 15:00:56.205

Current behavior

1.3.0
1.4.25
2.0.1
2021-09-28 15:09:36,280 INFO sqlalchemy.engine.Engine
            SELECT 1 AS has_table FROM rdb$database
            WHERE EXISTS (SELECT rdb$relation_name
                          FROM rdb$relations
                          WHERE rdb$relation_name=?)

2021-09-28 15:09:36,280 INFO sqlalchemy.engine.Engine [dialect firebird+fdb does not support caching 0.00027s] ('\nSELECT\n  1 "IntField",\n  \'Some words\' "TextField",\n  CURRENT_TIMESTAMP "UpdatedAt"\nFROM\n  mon$database\n',)
2021-09-28 15:09:36,280 INFO sqlalchemy.engine.Engine ROLLBACK
2021-09-28 15:09:36,280 INFO sqlalchemy.engine.Engine
SELECT
  1 "IntField",
  'Some words' "TextField",
  CURRENT_TIMESTAMP "UpdatedAt"
FROM
  mon$database

2021-09-28 15:09:36,280 INFO sqlalchemy.engine.Engine [raw sql] ()
Exception ignored in: <function PreparedStatement.__del__ at 0x000001E5F71F1EE0>
Traceback (most recent call last):
  File "C:\Temp\TstPandas\env\lib\site-packages\fdb\fbcore.py", line 3462, in __del__
    self._close()
  File "C:\Temp\TstPandas\env\lib\site-packages\fdb\fbcore.py", line 3338, in _close
    if is_dead_proxy(self.cursor):
  File "C:\Temp\TstPandas\env\lib\site-packages\fdb\fbcore.py", line 481, in is_dead_proxy
    return isinstance(obj, weakref.ProxyType) and not dir(obj)
ReferenceError: weakly-referenced object no longer exists
   IntField   TextField               UpdatedAt
0         1  Some words 2021-09-28 15:09:36.280

Desktop (please complete the following information):

  • OS: Windows 10 x64
  • Python 3.9.6
  • Firebird version 3.0.7 running official Win64 build.
  • sqlalchemy-firebird 0.7.0

Additional context
More info at: #32

Deployment to PyPI

Hi Paul. If you've been working with this dialect for a while and are fairly confident that it is stable enough for public release then it would be a good idea to get this up on PyPI. In the reasonably near future SQLAlchemy will start warning users of the old internal Firebird dialect that it is deprecated and it would be nice to be able to let them know that they can pip install sqlalchemy-firebird.

In a related note, I've been working with @zzzeek and the rest of the SQLAlchemy team on this issue that should help ease the transition. If the change is accepted then we should enable the firebird:// URI prefix for this dialect before public release. (We can continue to support firebird2:// to avoid unnecessary headaches for you or anybody else who's been working with this.)

I'd be happy to help out if you would like to proceed. Just let me know.

Revamp for SQLAlchemy 2.0 (was: SQLAlchemy test suite: Need for COMMIT between DDLs and DMLs)

Currently many tests are failing because Firebird needs a COMMIT between a DDL which (for example) creates a table and a DML which inserts data in this table. Without this the insert will fail saying the table doesn't exists.

I did some attempts to overcome this using SQLAlchemy events infrastructure (after_create) to force a COMMIT/BEGIN TRANSACTION but it opened a larger can of worms. It worked for some tests but crashed several other ones.

Has anyone already worked on this problem? I'm asking for ideas/guidance before I dig into it more.

In contact with SQLAlchemy developers they have told me this was one of reasons it caused they to eject Firebird from core project (since no other database appears to have this requirement). So, I believe we are on our own, here.

SAWarning: Did not recognize type 'BOOLEAN'

import sqlalchemy as sa

connection_uri = "firebird://sysdba:scott_tiger@localhost/C:/Users/Gord/git/sqlalchemy-firebird/MY_DB.FDB"
engine = sa.create_engine(connection_uri)

cnxn = engine.raw_connection()
crsr = cnxn.cursor()
try:
    crsr.execute("DROP TABLE bool_test")
except:
    pass
crsr.execute("CREATE TABLE bool_test (flag boolean)")
bool_test = sa.Table("bool_test", sa.MetaData(), autoload_with=engine)
"""console output:
c:\users\gord\git\sqlalchemy-firebird\sqlalchemy_firebird\base.py:904:
 SAWarning: Did not recognize type 'BOOLEAN' of column 'flag'
"""

firebird-driver not working with remote databases.

I just noticed firebird-driver does not accept a host argument in its .connect() method.

Trying to connect to anything other than a local database gives the error:

self = <sqlalchemy_firebird.firebird.FBDialect_firebird object at 0x0000020EAE2C2750>, cargs = ()
cparams = {'database': '//C:/Temp/data.fdb', 'host': 'TEST', 'password': 'masterkey', 'user': 'SYSDBA'}

    def connect(self, *cargs, **cparams):
        # inherits the docstring from interfaces.Dialect.connect
>       return self.loaded_dbapi.connect(*cargs, **cparams)
E       TypeError: connect() got an unexpected keyword argument 'host'

As discussed here the author has no intention to add a host argument to .connect().

I'm working on a PR now.

Support for descending indexes

Firebird indexes are a bit different than most others in that they are all uni-directional. We would need to do some tweaking of visit_create_index to support this, as described in

sqlalchemy/sqlalchemy#5106

That would be in addition to excluding the "noncol_idx" tests in ComponentReflectionTest.

  • update visit_create_index to emit a valid CREATE DESC INDEX... statement for Firebird

SQLCODE: -501 - Attempt to reclose a closed cursor

Describe the bug

A simple Pandas .read_sql() fails after installing this package.

Without sqlalchemy-firebird installed, the code works with the following warning:

SADeprecationWarning: The firebird dialect is deprecated and will be removed in a future version. This dialect is superseded by the external dialect https://github.com/pauldex/sqlalchemy-firebird.

After installing sqlalchemy-firebird the code doesn't work anymore. Failing with

fdb.fbcore.DatabaseError: ('Error while releasing SQL statement handle:\n- SQLCODE: -501\n- Attempt to reclose a closed cursor', -501, 335544577)

To Reproduce

basesSql = """
SELECT
  1 "IntField",
  'Some words' "TextField",
  CURRENT_TIMESTAMP "UpdatedAt"
FROM
  mon$database
"""

fbEngine = sqlalchemy.create_engine('firebird://...')

with fbEngine.connect() as fbConn:
    bases = pd.read_sql(basesSql, fbConn)

Expected behavior

Pandas .read_sql() executed successfully.

Desktop (please complete the following information):

  • OS: Windows 10.0.19042.1083
  • Python 3.9.6
  • Firebird 3.0.7
  • All pip packages installed with the latest release version
fdb==2.0.1
firebird-base==1.3.0
firebird-driver==1.2.1
future==0.18.2
greenlet==1.1.0
numpy==1.21.0
pandas==1.3.0
petl==1.7.4
protobuf==3.17.3
psycopg2==2.9.1
python-dateutil==2.8.1
pytz==2021.1
six==1.16.0
SQLAlchemy==1.4.20
sqlalchemy-firebird==0.7.0

[QUESTION] How can be run tests?

Hi @pauldex,
I wanted to try to contribute to your project but something is not clear to me...

I cloned and installed the project via pip install -r .\requirements_dev.txt but when I run pytest it fails with to the following stacktrace:

================================== sqlalchemy installation ==================================
SQLAlchemy 2.0.20 (user site loaded)
Path: D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\sqlalchemy\__init__.py
compiled extension enabled, e.g. D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\sqlalchemy\cyextension\util.cp39-win_amd64.pyd
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\_pytest\main.py", line 269, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\pluggy\_hooks.py", line 493, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)     
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\pluggy\_manager.py", line 115, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)       
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\pluggy\_callers.py", line 152, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\pluggy\_result.py", line 114, in get_result
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\pluggy\_callers.py", line 77, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\sqlalchemy\testing\plugin\pytestplugin.py", line 165, in pytest_sessionstart
INTERNALERROR>     asyncio._assume_async(plugin_base.post_begin)
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\sqlalchemy\testing\asyncio.py", line 53, in _assume_async
INTERNALERROR>     return _util_async_run(fn, *args, **kwargs)
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 242, in _util_async_run
INTERNALERROR>     return loop.run_until_complete(greenlet_spawn(fn, *args, **kwargs))        
INTERNALERROR>   File "C:\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
INTERNALERROR>     return future.result()
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 179, in greenlet_spawn
INTERNALERROR>     result = context.switch(*args, **kwargs)
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\sqlalchemy\testing\plugin\plugin_base.py", line 295, in post_begin
INTERNALERROR>     fn(options, file_config)
INTERNALERROR>   File "D:\Progetti\sqlalchemy-firebird\.venv\lib\site-packages\sqlalchemy\testing\plugin\plugin_base.py", line 443, in _engine_uri
INTERNALERROR>     db_urls.append(file_config.get("db", "default"))
INTERNALERROR>   File "C:\Python39\lib\configparser.py", line 781, in get
INTERNALERROR>     d = self._unify_values(section, vars)
INTERNALERROR>   File "C:\Python39\lib\configparser.py", line 1152, in _unify_values
INTERNALERROR>     raise NoSectionError(section) from None
INTERNALERROR> configparser.NoSectionError: No section: 'db'

As far as I understand, this is caused by SqlAlchemy testing suite which does not find any db section in the setup.cfg or test.cfg files.

Did you configure something that is only on your local workstation or am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.