Author Topic: Scripting SQLLite Repos with Powershell  (Read 30148 times)

PeterHeintz

  • EA User
  • **
  • Posts: 937
  • Karma: +57/-18
    • View Profile
Scripting SQLLite Repos with Powershell
« on: March 27, 2024, 07:51:53 pm »
I intend to write some powerpoint scrits to fiddle arount with qea repositories.
I assumend that "SQLite.dll" is in the EA installation but I do not find it.
Can anyone point my to the dll or say me how EA accesses SQLLite repositories internally.
Best regards,

Peter Heintz

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12978
  • Karma: +540/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Scripting SQLLite Repos with Powershell
« Reply #1 on: March 27, 2024, 10:20:52 pm »
You normally don't need direct database access.
Best practice is to use the API.
If you need to do an SQL Query, you can use the operation Repository.SQLQuery
That works on any backend (as long as your syntax is compatible)

Geert


ea0522

  • EA User
  • **
  • Posts: 89
  • Karma: +3/-0
    • View Profile
Re: Scripting SQLLite Repos with Powershell
« Reply #2 on: March 27, 2024, 10:39:06 pm »

Richard Freggi

  • EA User
  • **
  • Posts: 477
  • Karma: +18/-7
    • View Profile
Re: Scripting SQLLite Repos with Powershell
« Reply #3 on: March 28, 2024, 02:07:14 pm »
sqlite.org has an excellent introduction to CLI scripting.  You download the SQLite CLI and call it via your terminal, command prompt or whatever.  It works really well.

PeterHeintz

  • EA User
  • **
  • Posts: 937
  • Karma: +57/-18
    • View Profile
Re: Scripting SQLLite Repos with Powershell
« Reply #4 on: March 28, 2024, 06:40:24 pm »
I assume that there is already something included in the EA installation and when using this, I have no need to take care that something addtional needs to be installed for may users.
Of couse the API can be used and I do that, but some things are just not possible with the API.
Best regards,

Peter Heintz

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12978
  • Karma: +540/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Scripting SQLLite Repos with Powershell
« Reply #5 on: March 28, 2024, 06:53:16 pm »
I assume that there is already something included in the EA installation and when using this, I have no need to take care that something addtional needs to be installed for may users.
Of couse the API can be used and I do that, but some things are just not possible with the API.
Most things are possible with the API, if you know the secret backdoor Repository.Execute()

Geert

ea0522

  • EA User
  • **
  • Posts: 89
  • Karma: +3/-0
    • View Profile
Re: Scripting SQLLite Repos with Powershell
« Reply #6 on: March 28, 2024, 07:11:50 pm »
If you want to use the EA API, the EA client has to be running to provide the access to it.
Can imagine situations when this is not the case, especially when one wnats to run a script unattended.
Be aware however not to mess up the database integrity...

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12978
  • Karma: +540/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Scripting SQLLite Repos with Powershell
« Reply #7 on: March 28, 2024, 07:25:42 pm »
If you want to use the EA API, the EA client has to be running to provide the access to it.

You can also start the EA client from your script/program, but there is indeed the complication that you need to run whatever automated process in a user context, with a valid EA license.
That is definitely more complicated than running an unattended service on a server.

Geert

PeterHeintz

  • EA User
  • **
  • Posts: 937
  • Karma: +57/-18
    • View Profile
Re: Scripting SQLLite Repos with Powershell
« Reply #8 on: March 29, 2024, 05:44:22 am »
Yes I start EA already in my scipts.
Is there e.g. a back door to disable security? Did e.g. not find a API method for that an therefore my script just deletes the relevant record via SQL.
Best regards,

Peter Heintz

qwerty

  • EA Guru
  • *****
  • Posts: 13522
  • Karma: +395/-300
  • I'm no guru at all
    • View Profile
Re: Scripting SQLLite Repos with Powershell
« Reply #9 on: March 29, 2024, 09:27:40 am »
Just delete the contents of t_secpolicies and EA will start without security. There are a couple of threads here on the forum dealing with that topic.

q.