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

Rename file to dbo.sp_WhoIsActive.sql #4

Closed
ktaranov opened this issue Jul 29, 2019 · 59 comments
Closed

Rename file to dbo.sp_WhoIsActive.sql #4

ktaranov opened this issue Jul 29, 2019 · 59 comments

Comments

@ktaranov
Copy link
Contributor

Hi, Adam. Great thanks to move in open source club your awesome stored procedure. Could you rename who_is_active.sql to dbo.sp_WhoIsActive.sql (prefered for me ) or just sp_WhoIsActive.sql ?

@amachanic
Copy link
Owner

Can you share the reasoning behind that change?

@ktaranov
Copy link
Contributor Author

Hi, Adam, thanks for quick response. It is more clear and consistent naming files with production stored procedures with schema name (we use schemas for maintaining security roles ) and procedure name. First what I do with new version of your procedure - rename the file name. Also we use case sensitive instances and for us is very important to have correct notation: sp_whoisactive and sp_WhoIsActive critical difference in this case.

@paulholmes-london
Copy link

{SchemaName}.{ObjectName}.sql is also what Redgate source control uses, capitalised exactly as the object and schema are named.

@amachanic
Copy link
Owner

amachanic commented Jul 31, 2019

Okay. This seems like a reasonable request. I'm going to pin it for a few weeks.

If you're reading this and interested, please reply and cast a vote:

#1 Leave it as-is
#2 sp_WhoIsActive.sql
#3 dbo.sp_WhoIsActive.sql

My vote is #2.

This is entirely due to my personal preference of organizing objects by schema in subfolders. So I'd have a subfolder called "dbo" in my project, with all of my dbo. stuff in it.

@paschott
Copy link

Torn on this. I usually name my files just as files and they sit in a separate folder for schema so no schema prefix. I lean slightly towards #2, but wouldn't be bothered by #3. I do agree that the name of the file matching the name of the proc is a good thing.

@ktaranov
Copy link
Contributor Author

#3

@luporpi
Copy link

luporpi commented Jul 31, 2019

#2

@ClaudioESSilva
Copy link

ClaudioESSilva commented Jul 31, 2019

2

2 similar comments
@olegstrutinskii
Copy link

2

@wdcadmin
Copy link

2

@paulholmes-london
Copy link

#3 (neither SSMS File Per Object scripting, or Redgate source control, uses folder per schema)

@BobPusateri
Copy link

2

1 similar comment
@BruceSpruce
Copy link

2

@blaw-fc
Copy link

blaw-fc commented Jul 31, 2019

I prefer 3, but 2 is also fine.

@tgspacelabs
Copy link

#2

@lowlydba
Copy link

2

@beargle
Copy link

beargle commented Jul 31, 2019

My preference is 3 first, 2 at a close second.

Some examples, for those that may not be familiar with Red Gate or the default Visual Studio database project folder structures.

Red Gate SQL Source Control (i.e. number 3)

├───Assemblies
├───Data
...
├───Security
...
│ ├───Roles
│ ├───Schemas
│ ├───Symmetric Keys
│ └───Users
...
├───Stored Procedures
dbo.sp_WhoIsActive.sql
├───Synonyms
├───Tables
├───Views

Default (w/ schema folders) Visual Studio database project (i.e. number 2)

│ Database6.sqlproj
├───bin
│ └───Debug
├───dbo
│ ├───Stored Procedures
│ │ sp_WhoIsActive.sql
│ └───Tables
├───obj
│ └───Debug
├───Security
...

@MisterZeus
Copy link
Contributor

2 for me, because of Visual Studio defaults.

@vemund
Copy link

vemund commented Jul 31, 2019

3

@sqlmaas
Copy link

sqlmaas commented Aug 1, 2019

2 because of VS.

@andrew-bickerton
Copy link

Similar to a lot of others: 3, followed by 2 as an acceptable alternative

@MattHubble
Copy link

3

@NoDakCoder
Copy link

2 looks cleaner, and I personally sort projects and archives similarly (Server > Database > Schema > File)

@chrome-brutus
Copy link

3

@waynerossi
Copy link

2, if nothing else it matches. Don't like putting the schema in file names.

@robboek
Copy link

robboek commented Aug 6, 2019

2

@sam-bryant
Copy link

3

@AartBluestoke
Copy link

reasoning:
2, if used in scenario 3 removes information which is expected to be there.
3, if used in scenario 2 shows a redundant schema, a mild cosmetic effect (summarised above by comments "don't like")

Also in terms of 'fixing' the name, it is easier to delete a spurious dbo. in the dbo folder than it is to guess which schema should be prefixed onto a schema-less object.

Therefore, a reluctant 3, because it is the only thing that 'works' in both scenarios. (if magic could occur, 2 for the people that would like it, and 3 that would like it that way, but i don't think that magic exists)

Either 2 or 3 is better than having a slightly different name for the file than the thing it deploys.

@philcart
Copy link

philcart commented Aug 9, 2019

Would lean towards #3 as we have things arranged by object type, similar to what's in SQL Management Studio.

Could live with #2 as well.

You could also drop that "sp_" prefix :)

@Eagle3386
Copy link

#2

@amachanic: may I submit two suggestions for future votings:

  1. IIRC, there's a new GitHub extension for such vote calls
  2. Use emoji reactions for not only less wrongly linked issues (FYI: "#" creates links to that very issue), but also doesn't clutter the issue with simple replies and, most importantly, makes the counter recognizable on first sight.

@jericsmith
Copy link

2 - sp_WhoIsActive.sql

@jacobgexigo
Copy link

2

@kapsiR
Copy link

kapsiR commented Nov 22, 2019

#2 sp_WhoIsActive.sql

Matches the First Responder Kit's naming (btw. maybe integrate it there @BrentOzarULTD)

@fredclown
Copy link

#2

@uygary
Copy link

uygary commented Jan 14, 2020

I personally vote for option 2.
I prefer using source control for db objects, and structuring the repo along the lines of: DatabaseName/SchemaName/ObjectName.sql

Option 3 would be preferable to option 1, but it would still not be ideal due to the flattened hierarchy it causes.

@EmanueleMeazzo
Copy link

Vote for 2

@PianoMatt
Copy link

3

@spike1234
Copy link

#2

@bruce-dunwiddie
Copy link

3

@imajaydwivedi
Copy link

#2 sp_WhoIsActive.sql

@Eagle3386
Copy link

@amachanic ~1.5 years passed, so when you're choosing the winning option since you've originally wrote about pinning it "for a few weeks"?

@WaydeBunker
Copy link

#2

1 similar comment
@mattcargile
Copy link

#2

@runamuk0
Copy link

runamuk0 commented Jan 4, 2021

I like #2 as well for organization.

@bonomo1
Copy link

bonomo1 commented Jan 4, 2021

3

@atompkins
Copy link

2

1 similar comment
@speedy32129
Copy link

2

@amachanic
Copy link
Owner

@amachanic ~1.5 years passed, so when you're choosing the winning option since you've originally wrote about pinning it "for a few weeks"?

I've been attempting to learn the virtue of patience. :-)

(I'll get to it very shortly, I promise.)

@speedy32129
Copy link

2

@sozezzo
Copy link

sozezzo commented Apr 19, 2021

2

@MikeyBronowski
Copy link

2

@erikdarlingdata
Copy link
Collaborator

@amachanic what if we just had all three available and kept them synced via some automation?

@amachanic
Copy link
Owner

Okay, I just counted the votes, finally.

2 wins.

Here's the plan: I'm going to add a second file, copy of the first, with the new name. We'll carry it for a few versions. Then we'll drop the old file. Simple :-)

@ktaranov
Copy link
Contributor Author

ktaranov commented Nov 9, 2021

@amachanic great thanks!

I'm going to pin it for a few weeks

We also learned what a few weeks is equal to for adam smith) 118 weeks) my longest contribution to open source.

@ktaranov ktaranov closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests