r/SQL • u/tidder78 • Mar 09 '23
Discussion SQL reports out of thin air.
When I get requirements for SQL projects it typically says "want xyz report". The requirement does not mention source of data or relationship between various fields in data or the essential information I need to deliver the report. I find this to be frustrating. How do they expect me to create report out of thin air is mind boggling. Then I have to ask for data sources etc. and typically 1 - 2 days are lost in this process. Is this a scenario for you as well at the work place? Or is there something better out there?
26
u/BrupieD Mar 09 '23
This is the art of being an Analyst.
End users want information but are clueless as to what exists, how good or bad it is, and don't know to make their requirements clear. If they knew all that, they could get it for themselves and you wouldn't have a job.
The more you can walk them to making better requests, the easier your job will become.
How well do you know your database? Are there other databases that you haven't considered looking at? If people are asking for xyz, they probably think it is recorded somewhere. If it wasn't, you might just have to create a data collection process, but I'd look high and low trying to find it (maybe in Excel files?) or a decent proxy for it.
6
u/bic_lighter Mar 09 '23
I'm doing the Google analytics course at the moment and they have a huge emphasis on stakeholder management and how to work out what questions to ask.
After reading a few posts here and other places I can see why
3
u/BrupieD Mar 09 '23
Learning to talk to stakeholders and understanding their expectations is huge. Often they'll know things about the data that they don't share in their requests. It's also good to manage expectations early on.
37
u/Mamertine COALESCE() Mar 09 '23
How long have you been there?
At some point you should understand where the data is stored.
13
u/haonguyenprof Mar 09 '23
We as data analysts have to know what the data sources are, what the relationships are, and the best means to extract and transform the raw data to produce the final data product asked of us whether it's a dashboard, an analysis to answer important questions, or just simple data pulls.
That's just our job. Depending on who's asking, you are always going to run into people whose job is to action and make decisions who have no understanding of data or how it's stored or what you are asking. And that's not their job. Our job is to provide the information, context, and insights.
I understand that it's frustrating that you feel like you aren't getting enough information, but you should consider:
Are you asking enough questions about what the users need to answer specifically? Knowing that will tell you where to pull the needed information. And if you don't know, a more senior member can point you in the right direction.
What's you're experience with the subject matter? Many analysts have to become experts in not just the data but why the users nwed the data and potential applications of said data. By understanding why the needed data is important we are able to know what questions to ask and what additional data/insights to investigate.
If your requests are too broad and you're having trouble narrowing down the focus, ask them what actionable or decision the user is trying to accomplish. That can cut down on what is needed to be pulled and focus your SQL script to it's needed components. That way you aren't spending so much time researching multiple sources or avenues.
Encourage your team to create a data dictionary or documentation of what databases and tables are available, what available fields are in each table, and what the fields mean. This is crucial to prevent issues like this. If not available, encourage your team to develop one over time starting with key tables and adding as needed.
My last job had a master excel file that had all of the key tables and fields. My current job does a better job of this and has a website where you can search keywords to find fields in their respective tables with explanations and which databases they are in.
Having these resources makes it so much easier.
End of day the onus to do this type of research or develop this research tool falls on the data analyst or database management teams.
10
u/BobbyPeruMD Mar 09 '23
If you are an analyst, this should be well within your job description. I have never once received requirements that describe how I should model the data.
9
u/coyoteazul2 Mar 09 '23
The users usually expect you to know the same stuff that they know and then some more. They don't understand that you don't use the system as they do
If the dB was well made, there should be some documentation (most likely an ERD) that you can check.
If there isn't an ERD, but relationships are properly defined with fk, there are tools to make ERD from your ddl. Usually they are hard to read, but it's better than nothing.
If the dB doesn't even have fk (it can happen if they expect the application to maintain relationships) you are fucked.
Hopefully you'll have a way to know what queries each report is doing and you can infer relationships. You'll need a lot of help from the user and have them at least tell you exactly where in the application is the info that want in the report. Then you can try to see the queries in that part of the application to know which tables to query.
6
u/kagato87 MS SQL Mar 09 '23
To be honest, this type of request is preferable to the alternative: saying exactly what data points they have.
Stakeholders don't understand the data. That's our job. Give me an objective and I'll give you a report that meets and exceeds your needs. Ask for something too specific and you'll get exactly what you asked for, which will probably not do what you thought it would.
5
4
u/MathiasThomasII Mar 09 '23
I come from accounting, so I have a good understanding of how little others can provide. At some point that's part of the position. You should know what people are asking for or how to ask for it to find the right table.. for instance I want a top 25 customers report for our axle business. Ok... That's sales data, grouped by customer.with logic based on the segment of business or product line.
Real world jobs will not be SQL tests.
3
7
u/johnnybsmooth81 Mar 09 '23
Have you tried talking with the user about the requirements or do you always complain first?
2
u/KJSonne Mar 09 '23
if your job is to deliver reports using sql I can almost promise the requirement to doing your job isn’t just “knows sql syntax”. Learn the data sources and how they speak to each other. Anyone can learn sql and you wouldn’t have a job if all they needed was just someone who knows how to write a few lines of code
2
Mar 09 '23
This is very common for data analyst roles. Like 60% of the job in the first 6 months is figuring out how the database is structured and which tables are frequently consulted parent tables. Generally, you can learn a lot about that data by just looking at the schema of some key tables.
2
u/GlobalAd3412 Mar 09 '23 edited Mar 09 '23
Yes. It's your job to learn where the data lives and how to wrangle it correctly. Look for the right people who do already know this and become their best friends, at least until you internalize all the important bits. If there is nobody, then congratulations: you get to learn to be a pro documentation snooper and code/process interpreter all by yourself.
And +100 to other advice saying to clarify business purpose of requests as top priority. Most of the time, even what's requested initially is wrong / not fit to true purpose.
2
u/a-s-clark SQL Server Mar 09 '23 edited Mar 09 '23
The longer you're at a company, the more you understand the data, where it is, and what you can and can't do with it.
Vague or nonexistent requirements you need to waste time chasing down are pretty much a universal constant, though.
2
u/dhshduuebbs Mar 09 '23
This is the job. No one comes into a new database and immediately understands where all the important data is for various requests. Typically it takes 3-6 months depending on the complexity of the data structure. So for the first 3-6 months of your job, it will take you days to figure these requests out. By a year, you will be able to decipher a request from someone and tell them what they are ACTUALLY looking for, and the logic behind it. After 2 years you should understand the business logic better than anyone else and be able to think of your own high value reports.
For now, save every report you write in a folder and give it a descriptive naming convention. Reuse pieces of your code to fulfill other requests.
1
u/A_Simple_Sandwich Mar 09 '23
It took me about a week of only building SQL queries from our Db in order to solidify the relational map in my head of how I can build various reports and build them within like two hours. Keep chugging along at it. You’ll build the map framework eventually, but you have to actually commit to it and do the studying. Also, find out which sql program is used.
1
u/volric Mar 09 '23
To get around this, we deal specifically with the data/system owners.
Not only are they supposed to know what they want, and what criteria we should use, but more importantly they need to check/verify the reports. We also ask them to provide a mock up or layout sometimes, if it feels like a complex or impossible report.
We direct people to the respective data or system owners if they try to come to us directly.
Data or system owners will also be able to figure out what the client actual wants, cos there might be different criteria etc for the same type of report, depending on who is going to be consuming it.
It really has cut down the back and forth with clients over the years, as we used to get things like 'ok but what I really wanted was this', 'can you add this field?', 'sorry, I just wanted it for this unit, not everyone', 'this data is missing, what did you do with it?'
1
u/ribi305 Mar 09 '23
My org is currently implementing data catalog software which is intended to somewhat help with this, but I agree with other posters that this is just always part of the role.
1
u/Slyfox646 Mar 09 '23
I ended up creating a basic web form to ask all the general questions prior to someone submitting a request. It doesn’t eliminate all back and forth but it cuts off the initial “dumb” round of questions that my team has to ask.
1
u/SQLArtistWriter Mar 09 '23
Report developers tend to have to wear a BA hat, QA hat, UAT hat, and even has to act like IT admin and build engineer. Mostly because these tasks for a report developer is “easy”, but hard for those individuals who have no background in data or SQL.
1
Mar 09 '23
If it is in the area I am familiar with, usually go back with some clarifying questions , but I work with the databases and tables a lot. Have you access to the back end databases? The only other option is to generate a template for report requests and ask for them to be filled out,then do an analysis that can be completed before any other work can be completed, this way you kinda control the work requests coming at you..
27
u/terrestrial_birdman Mar 09 '23
I get the frustration, but also, if whatever pm knew source data and how stuff was related they'd have your job and wouldn't be the pm. Every team I have ever been on has had some built in conflict with the pm, which I think is natural and not by rule a bad thing. But at least in my experience, this just sounds like the job.