You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rparsonsbb (via GitHub)" <gi...@apache.org> on 2024/10/15 17:00:41 UTC
[I] SQL Server type `uniqueidentifier` causes error in meta database [superset]
rparsonsbb opened a new issue, #30612:
URL: https://github.com/apache/superset/issues/30612
### Bug description
When querying a SQL Server database via the meta database, tables with `uniqueidentifier` columns are not able to be queries and throw `1002` errors.
The tables are able to be queries when connecting directly via a `mssql+pymssql://` database connection.
Easy reproduction:
1. Create a few dummy tables in a sql server database:
```
-- Create the TestUsers table with a uniqueidentifier column
CREATE TABLE Users (
UserID UNIQUEIDENTIFIER DEFAULT NEWID() NOT NULL, -- uniqueidentifier column
FirstName NVARCHAR(50) NOT NULL,
LastName NVARCHAR(50) NOT NULL,
Email NVARCHAR(100) NOT NULL
);
-- Create the TestProducts table without a uniqueidentifier column
CREATE TABLE Products (
ProductID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, -- Auto-incrementing integer column
ProductName NVARCHAR(100) NOT NULL,
Price DECIMAL(10, 2) NOT NULL
);
```
2. Add data
```
-- Insert 10 rows of dummy data into the Users table
INSERT INTO TestUsers (FirstName, LastName, Email)
VALUES
('John', 'Doe', 'john.doe@example.com'),
('Jane', 'Smith', 'jane.smith@example.com'),
('Bob', 'Johnson', 'bob.johnson@example.com'),
('Alice', 'Williams', 'alice.williams@example.com'),
('Tom', 'Brown', 'tom.brown@example.com'),
('Nancy', 'Davis', 'nancy.davis@example.com'),
('Chris', 'Miller', 'chris.miller@example.com'),
('Megan', 'Wilson', 'megan.wilson@example.com'),
('Luke', 'Moore', 'luke.moore@example.com'),
('Emily', 'Taylor', 'emily.taylor@example.com');
-- Insert 10 rows of dummy data into the Products table
INSERT INTO TestProducts (ProductName, Price)
VALUES
('Laptop', 999.99),
('Smartphone', 699.99),
('Tablet', 299.99),
('Monitor', 199.99),
('Keyboard', 49.99),
('Mouse', 29.99),
('Headphones', 89.99),
('Smartwatch', 199.99),
('Printer', 149.99),
('Camera', 549.99);
```
3. Create the connection for the database in superset
4. Select from the SQL Lab using the MSSQL connection:


5. Select the data using the meta database:


I'm assuming that it has to do with how the meta database handles `uniqueidentifier` types and a custom class might be needed, but would love some insight before trying to tackle the PR.
### Screenshots/recordings
_No response_
### Superset version
master / latest-dev
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] SQL Server type `uniqueidentifier` causes error in meta database [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30612:
URL: https://github.com/apache/superset/issues/30612#issuecomment-2414556829
<!-- Greeting -->
Hey @rparsonsbb, I'm here to help you with any bugs, questions, and even guide you to become a contributor. Let's squash those bugs together! 😊
<!-- Answer -->
The issue you're encountering with the `uniqueidentifier` type in SQL Server when using Superset's meta database likely stems from the lack of specific handling for this data type within Superset's current implementation. As of now, there isn't a documented custom class or type mapping in Superset specifically for handling SQL Server's `uniqueidentifier` type <sup>[[1]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/mssql.py)</sup>.
To address this, you might consider extending or customizing the data type handling in Superset's meta database. This could involve creating a custom type mapping or conversion function for the `uniqueidentifier` type. You can look into the `MssqlEngineSpec` class, which handles SQL Server-specific data types, as a starting point for implementing this functionality <sup>[[1]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/mssql.py)</sup>.
If you decide to proceed with a pull request, it would be beneficial to add a custom type mapping for `uniqueidentifier` in a similar manner to how other SQL Server types are handled. This could involve defining a new SQLAlchemy type or conversion logic that correctly interprets `uniqueidentifier` values when querying through the meta database.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] SQL Server type `uniqueidentifier` causes error in meta database [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe closed issue #30612: SQL Server type `uniqueidentifier` causes error in meta database
URL: https://github.com/apache/superset/issues/30612
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org