Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed on MySQL with schema name containing dash #509

Open
DmitryBatalov opened this issue Jan 25, 2018 · 3 comments
Open

Failed on MySQL with schema name containing dash #509

DmitryBatalov opened this issue Jan 25, 2018 · 3 comments

Comments

@DmitryBatalov
Copy link

Description

When trying to get Individuals, for example, you'll get the error
error FS3021: Unexpected exception from provided type FSharp.Data.Sql.SqlDataProvider,DatabaseVendor="3",ConnectionString="Server=localhost;Database='prefix-portal';User=user;Password=******",ResolutionPath="c:\\Projects\\tmp\\sql\\MySqlDemo/../../../packages/scripts/MySql.Data/lib/net45",UseOptionTypes="True",Owner="prefix-portal"+dataContext+prefix-portal.customers.Individuals' member 'GetMethods': The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-portal.customers LIMIT 1000' at line 1
`

Repro steps

Please provide the steps required to reproduce the problem

  1. Create MySQL schema with name "db-test" and add one table "Customers".
  2. Create script try to get individuals of Customers.

Expected behavior

It should run without error.

Actual behavior

Fails with the message shown above.

Known workarounds

Rename schema, but in my case, it's not possible.

Related information

  • Used database - MySQL
  • Operating system - Windows 10
  • Branch - master
  • .NET Runtime, CoreCLR or Mono Version - .NET CORE 2.0
@Thorium
Copy link
Member

Thorium commented Jan 25, 2018

Ok, this is clearly not very typical database:

MariaDB [(none)]> create database db-test;

ERROR 1064 (42000): You have an error in your SQL syntax; 
check the manual that corresponds to your MariaDB server version 
for the right syntax to use near '-test' at line 1

Hmm... would it have a side effects, adding backticks to SQLProvider database names?

@DmitryBatalov
Copy link
Author

If I set the backticks then SLQProvider doesn't see the database.

@DmitryBatalov
Copy link
Author

In my case the workaround could be applied, I've just created synonym database. https://dev.mysql.com/doc/refman/5.7/en/sys-create-synonym-db.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants