cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Entityframework Core Scaffold Database Model Stuck

kerria
Explorer
0 Likes
3,702

I can't scaffold with Sap.EntityFrameworkCore.Hana.

v7.0, the process stuck for hours

Accepted Solutions (0)

Answers (9)

Answers (9)

minghai_chang
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello,

Sorry for not getting back to you sooner. I tried to create the HIS_TUKIN table with the schema. But it always fails with the following error.

"sql syntax error: incorrect syntax near: line 5 col 21 (at pos 136)"

If I remove all CS_ types, I can create the table and scaffold code for it.

Which server version are you using? Do you know of any configuration settings which can enable the use of CS_ types?

Kind regards,

Minghai Chang

kerria
Explorer
0 Likes
Server version i've using is 2.00.074.00.1698716871, and for configuration about CS_types i think is default from begining because nether i don't know anything about CS_types
kerria
Explorer
0 Likes

Haii it's me again. I tried scaffold with --schema option, and i think it's work because i found new error.

When i searched there's only one with column 'ID_HIS_TUKIN'

# Here's detail data

SCHEMA_NAME : TDES
TABLE_NAME : HIS_TUKIN
TABLE_OID : 1,270,955
COLUMN_NAME : ID_HIS_TUKIN
POSITION : 1
DATA_TYPE_ID : 12
DATA_TYPE_NAME : VARCHAR
OFFSET : 72
LENGTH : 32
SCALE : [NULL]
IS_NULLABLE : FALSE
DEFAULT_VALUE : SYSUUID
COLLATION :
COMMENTS : [NULL]
MAX_VALUE : [NULL]
MIN_VALUE : [NULL]
CS_DATA_TYPE_ID : 83
CS_DATA_TYPE_NAME : STRING
DDIC_DATA_TYPE_ID : 32
DDIC_DATA_TYPE_NAME : INVALID
COMPRESSION_TYPE : DEFAULT
INDEX_TYPE : FULL
COLUMN_ID : 1,294,853
PRELOAD : FALSE
GENERATED_ALWAYS_AS : [NULL]
HAS_SCHEMA_FLEXIBILITY : FALSE
FUZZY_SEARCH_INDEX : FALSE
FUZZY_SEARCH_MODE : [NULL]
MEMORY_THRESHOLD : [NULL]
LOAD_UNIT : DEFAULT
GENERATION_TYPE : [NULL]
IS_CACHABLE : FALSE
IS_CACHE_KEY : FALSE
ROW_ORDER_POSITION : [NULL]
IS_HIDDEN : FALSE
IS_MASKED : FALSE
MASK_EXPRESSION : [NULL]
CLIENTSIDE_ENCRYPTION_STATUS : [NULL]
CLIENTSIDE_ENCRYPTION_COLUMN_KEY_ID : [NULL]
CLIENTSIDE_ENCRYPTION_MODE : [NULL]
PERSISTENT_MEMORY : [NULL]
NUMA_NODE_INDEXES : [NULL]

# Here;s DDL from the table HIS_TUKIN

kerria
Explorer
0 Likes

I'm not problem with only CLI. i'm just want tell when using ado.net we can scaffold by schema so several table can be generated at once, and don't have problem anything.

What my problem is 'Can i scaffold using --schema options'. Because when i use --schema options, it's say 'Hana doesn't support schema'

Unfortunately I can't post the entire schema, because it's written in my contract not to post anything.

minghai_chang
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello,

Unfortunately, the EF Core scaffolding only has command line options. It doesn't has GUI tool. Is it possible to use the combination of schemas and tables to scaffold your model? I mean you could add the referenced tables using table options. Could you post the schema of REF_SSBP table so we can test it?

Kind regards.

Minghai Chang

kerria
Explorer
0 Likes

But if i use 3rd example, that means i must set --table for each table? isn't that inefficient? i mean in this project we have tables more than 100.

Table that mention in error are in the same schema, i think why error occurs because class model for table not generated, that's why i need scaffold using 'schema'.

# table REF_SSBP of course have Primary Key

---------------------------

Disclaimer

this is the old system that need rejuvenate, previously we use ADO.NET at .NET Framework for scaffold model. but since .NET Core / .NET has launched we must change everything that related to .NET Framework to .NET Core / .NET.

At ADO.NET we can select the schema we want to scaffold. Since it's using Gui we just checked the checkbox of schema name and click button okey at visual studio.

minghai_chang
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello,

Yes, you can just specify several tables to scaffold the model (e.g. the 3rd example).

The first error looks like some tables are owned by different schemas. The second error looks like REF_SSBP table doesn't have primary key.

Kind regards,

Minghai Chang

kerria
Explorer
0 Likes

but if i use 3rd example, that means i must set --table for each table? isn't that inefficient? i mean in this project we have tables more than 100.

table that mention in error are in the same schema, i think why error occurs because class model for table not generated, that's why i need scaffold using 'schema'.

table REF_SSBP of course have Primary Key

------------

Disclaimer

this is the old system that need rejuvenate, previously we use ADO.NET at .NET Framework for scaffold model. but since .NET Core / .NET has launched we must change everything that related to .NET Framework to .NET Core / .NET.

At ADO.NET we can select the schema we want to scaffold. Since it's using Gui we just checked the checkbox of schema name and click button okey at visual studio.

kerria
Explorer
0 Likes

i have tried the latest version. It's work for several table but some other table doesn't.

# version of Hana Client

# Scaffold CLI

# Table REF_SSBP

With the latest version of Hana Client, can i scaffold just using schema for several table?

minghai_chang
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello,

We have fixed some issues related to EF Core Scaffolding. Can you please try the latest HANA Client?

Kind regards,

Minghai Chang

kerria
Explorer
0 Likes

i'm using .NET 7.

For SAP Client -> Sap.Data.Hana.Core.v2.1 and Sap.EntityFrameworkCore.Hana.v7.0.

1. dotnet ef dbcontext scaffold "Server=<my-server:30015>;uid=<uid>;pwd=<pwd>r;Current Schema=DEMO" Sap.EntityFrameworkCore.Hana.v7.0

2. dotnet ef dbcontext scaffold "Server=<my-server:30015>;uid=<uid>;pwd=<pwd>" Sap.EntityFrameworkCore.Hana.v7.0 --schema DEMO --schema SYSTEM

3. dotnet ef dbcontext scaffold "Server=<my-server:30015>;uid=<uid>;pwd=<pwd>" Sap.EntityFrameworkCore.Hana.v7.0 --table Blogs --table Posts

for the first and second methods it keeps getting stuck, for the third method it works but not as expected.

The DbContext generated but Model for table not generated.

It's there way to scaffold for the schemas? because if using --table option, i must scaffold one per one each table and it's using to much time