I have a relational database on MSSQL, I've created this one on a different schema (titan) than DBO. When I try to retrieve the models from my database, the composer of strongloop arc only shows those tables that are currently saved on DBO schema but not my tables saved in my custom schema.
Any help might be useful. Thanks in advance.
For relational database discovery, LoopBack API allows you to supply schema and table. But the schema is not exposed by StrongLoop Arc. As a result, only default schema names are used by Arc. Please note dbo is the default schema name for mssql.
I suggest you open a feature request on github for StrongLoop Arc.
Related
For LB3 there is specific documentation on how create database tables for built-in models, but for LB4 it seems missing, the closest thing I could find is this page in the migration guide, but it just explain the difference in models persistence handling and the advantages on having the repositories handling it instead of the models themselves.
Moreover, already having a mysql-based datasource, trying to create a repository to handle Users persistence result in error since it seems not to find the User built-in model.
How can I create table for built-int models, e.g. User, in LB4?
Update #1
Found this page in the documentation that tells how to list models to migrate and to use npm run migrate so I've tryied to put User in the list but got the foolowing error: so it seems to find/recognize the model but complains about it not having datasource settings in the model() decorator (I guess).
root#71827bda8df9:/home/node/app# npm run migrate
> backend#0.0.1 premigrate
> npm run build
> backend#0.0.1 build
> lb-tsc
> backend#0.0.1 migrate
> node ./dist/migrate
Migrating schemas (alter existing schema)
Cannot migrate database schema Error: Cannot migrate models not attached to this datasource: User
at /home/node/app/node_modules/loopback-datasource-juggler/lib/datasource.js:1146:12
at processTicksAndRejections (node:internal/process/task_queues:78:11)
Long story short
Cannot create tables for built-in models.
Why?
Found this SO question with a similar problem, and the accepted answer links to this docs page where built-in models are still marked as TBD almost 4 years later.
So what now?
I guess I have to create my own user model and integrate it with what LB4 offers me to handle users authentication.
I am working on a project that requires connecting to an existing remote Oracle database. the problem is that the client has not given full access to the database. instead i'm only given accesss to some views(Relational Database View) of the database. the table names are not provided.
I'm able to perfrom raw sql queries to the legacydb in my django view.
But it would be very much more easier if i could generate the models for these views and use django ORM. is there any way to accomplish this? What I'm expecting is to use some commands like inspectdb to generate the models from the view provided by the oracle legacy database.
We are using WSO2 identity server with LDAP as a user store. Now we would like to replace LDAP with database because of huge load (> 10 Millions) and growing. I have migrated the users but how tenant details in wso2 core database could be set with the new user store. That is the user store xml details are stored in their tenant table. How this could be migrated. Or what are all the changes, configurations, needs to be set in wso2 identity server level.
At the moment we don't have exact mechanism to migrate data from one DB type to another. What we have is upgrading one version to another using same DB.
But you can do this migrating data from an LDAP to any DB like MySQL manually. If you can write an shell script to convert LDAP data toa csv file, its easy for you to move to a MySQL like DB in one import command.
Furthermore, I was able to find out some similar articles which can help you to migrate content from LDAP to MySQL [2],[3],[4]
The table structures of DB types can be found from [1].
Once you migrate the data to JDBC, you can change the custom-userstore.xml file with new connection values and restart the server. If you changed your primary user store, you need to change the user store configurations in user-mgt.xml file.
Please let me know if you need further help in migrating.
[1]https://docs.wso2.com/display/IS550/Data+Dictionary
[2] https://social.msdn.microsoft.com/Forums/sqlserver/en-US/dfae020f-a3bf-4e9b-9614-eccf7890f8c6/how-to-extract-data-from-ldap-and-then-import-it-into-sql-database-for-quicker-retrieval?forum=transactsql
[3]Active Directory data into SQL table
[4] https://www.egnyte.com/blog/2014/01/how-we-migrated-millions-of-users-from-ldap-to-mysql-using-feature-flags/
I'm creating a bus booking website using Django. I'm stuck at what the database tables should look like. So far I've created the displayed tables, I'm very poor with databases so please mention foreign keys and primary keys when answering. Also, I'm stuck on how to actually book seats in Django, like what will be the code in the background and what other packages should I use. Thanks.
Table- Route:
Columns - route_id (primary key),
location_from,
location_to,
route_name,
Table - Bus:
Columns - Bus_id(primary key), type_of_bus,
bus_registration,
capacity,
bus_number,
route (foreign key)
Also I'm using the default sqlite database that comes with django. Is it good enough to build this kind of website or do I need to change? This website is just a project and will never go into production phase.
I'd highly recommend writing your database schema in Python classes (as Django models) and then using ./manage.py makemigrations ./manage.py migrate, which will look at your model code and create the corresponding database schema. This portion of the django tutorial could be helpful to you.
The python code corresponding to your example for a route would look something like:
from django.db import models
class Route(models.model):
location_from=models.CharField()
location_to=models.CharField()
route_name=models.CharField()
This is a much easier way to write a database schema, especially if you're not so hot with databases.
If your app will never be in production, SQLite is fine - it's very similar to other database engines for toy projects.
As for what your data model should look like, I think it depends how complex you want to make the app. For a start, I think you could add a Location model, which your Route model should reference. For making reservations, you could look into django booking - I haven't used it but it comes up on django packages when you search 'booking'.
We are reviewing Loopback as a framework for establishing a RESTful API for our already existing MySQL database.
When using the StrongLoop Arc GUI for automatically discovering models based on our database, a conflict with the "user" table was reported.
The problem is that Loopback creates a default model named user, and our database has a table named user.
How do you recommend that we resolve this conflict?