Hi All,
Can Python parse a trace file created with MS SQL's profiler? There
are a few thousand lines in the trace file and I need to find the
insert statements and the stored procedures. Unfortunately, I am not
an SQL guru and was hoping Python could help.
Any pointers are appreciated.
Thanks!
Mike 4 2963 ky******@gmail. com wrote:
Can Python parse a trace file created with MS SQL's profiler? There
are a few thousand lines in the trace file and I need to find the
insert statements and the stored procedures. Unfortunately, I am not
an SQL guru and was hoping Python could help.
Mike
Mike,
Can I suggest that, since the answer is more to
do with parsing and less to do with MSSQL (which
simply generated the output) that you post an example
of a trace file to some web location to see if anyone
wants to pick up the challenge?
I'm not at work so I don't have access to MSSQL, but
I seem to remember that you can output/save as XML,
which may make things easier (or at least interest a
different group of people in having a look).
I'm quite certain it can by done by Python; I did
consider it myself a couple of months back, but my
colleague spotted the problem before I'd really got
into the code!
TJG
On May 7, 8:34 am, Tim Golden <m...@timgolden .me.ukwrote:
kyoso...@gmail. com wrote:
Can Python parse a trace file created with MS SQL's profiler? There
are a few thousand lines in the trace file and I need to find the
insert statements and the stored procedures. Unfortunately, I am not
an SQL guru and was hoping Python could help.
Mike
Mike,
Can I suggest that, since the answer is more to
do with parsing and less to do with MSSQL (which
simply generated the output) that you post an example
of a trace file to some web location to see if anyone
wants to pick up the challenge?
I'm not at work so I don't have access to MSSQL, but
I seem to remember that you can output/save as XML,
which may make things easier (or at least interest a
different group of people in having a look).
I'm quite certain it can by done by Python; I did
consider it myself a couple of months back, but my
colleague spotted the problem before I'd really got
into the code!
TJG
Good point. Unfortunately, I think our SQL Server must be too old for
xml (we have version 8). The only save options I see is Trace
Template, Trace File, Trace Table and SQL Script.
Mike ky******@gmail. com wrote:
On May 7, 8:34 am, Tim Golden <m...@timgolden .me.ukwrote:
>kyoso...@gmail .com wrote:
>>Can Python parse a trace file created with MS SQL's profiler? There are a few thousand lines in the trace file and I need to find the insert statements and the stored procedures. Unfortunately, I am not an SQL guru and was hoping Python could help. Mike
Mike,
Can I suggest that, since the answer is more to do with parsing and less to do with MSSQL (which simply generated the output) that you post an example of a trace file to some web location to see if anyone wants to pick up the challenge?
I'm not at work so I don't have access to MSSQL, but I seem to remember that you can output/save as XML, which may make things easier (or at least interest a different group of people in having a look).
I'm quite certain it can by done by Python; I did consider it myself a couple of months back, but my colleague spotted the problem before I'd really got into the code!
TJG
Good point. Unfortunately, I think our SQL Server must be too old for
xml (we have version 8). The only save options I see is Trace
Template, Trace File, Trace Table and SQL Script.
Yes, you're right; I have clients installed for SQL 2000 &
2005 and it's only under 2005 that I have the XML output
option. The .trc file format is pretty much opaque binary,
and the .sql output only gives you the SQL statements
issued - not the events they're associated with.
One obvious way is to save it to a table and to interrogate
that table. I find that kind of thing a bit cumbersome, but
if XML's not an option, it might be the only way. (FWIW,
I find XML cumbersome too, but that might just be lack
of practice ;)
Running a standard trace and saving to a table, this is
the structure which resulted:
CREATE TABLE [trace_output] (
[RowNumber] [int] IDENTITY (1, 1) NOT NULL ,
[EventClass] [int] NULL ,
[TextData] [ntext] COLLATE SQL_Latin1_Gene ral_CP1_CS_AS NULL ,
[NTUserName] [nvarchar] (128) COLLATE
SQL_Latin1_Gene ral_CP1_CS_AS NULL ,
[ClientProcessID] [int] NULL ,
[ApplicationName] [nvarchar] (128) COLLATE
SQL_Latin1_Gene ral_CP1_CS_AS NULL ,
[LoginName] [nvarchar] (128) COLLATE
SQL_Latin1_Gene ral_CP1_CS_AS NULL ,
[SPID] [int] NULL ,
[Duration] [bigint] NULL ,
[StartTime] [datetime] NULL ,
[Reads] [bigint] NULL ,
[Writes] [bigint] NULL ,
[CPU] [int] NULL ,
PRIMARY KEY CLUSTERED
(
[RowNumber]
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Seems like you might be able to do something with it.
(Possibly just dumping it straight back out to CSV
or XML if that's easier for you than db querying)
TJG
On May 8, 5:18 am, Tim Golden <m...@timgolden .me.ukwrote:
kyoso...@gmail. com wrote:
On May 7, 8:34 am, Tim Golden <m...@timgolden .me.ukwrote:
kyoso...@gmail. com wrote: Can Python parse a trace file created with MS SQL's profiler? There are a few thousand lines in the trace file and I need to find the insert statements and the stored procedures. Unfortunately, I am not an SQL guru and was hoping Python could help. Mike
Mike,
Can I suggest that, since the answer is more to
do with parsing and less to do with MSSQL (which
simply generated the output) that you post an example
of a trace file to some web location to see if anyone
wants to pick up the challenge?
I'm not at work so I don't have access to MSSQL, but
I seem to remember that you can output/save as XML,
which may make things easier (or at least interest a
different group of people in having a look).
I'm quite certain it can by done by Python; I did
consider it myself a couple of months back, but my
colleague spotted the problem before I'd really got
into the code!
TJG
Good point. Unfortunately, I think our SQL Server must be too old for
xml (we have version 8). The only save options I see is Trace
Template, Trace File, Trace Table and SQL Script.
Yes, you're right; I have clients installed for SQL 2000 &
2005 and it's only under 2005 that I have the XML output
option. The .trc file format is pretty much opaque binary,
and the .sql output only gives you the SQL statements
issued - not the events they're associated with.
One obvious way is to save it to a table and to interrogate
that table. I find that kind of thing a bit cumbersome, but
if XML's not an option, it might be the only way. (FWIW,
I find XML cumbersome too, but that might just be lack
of practice ;)
Running a standard trace and saving to a table, this is
the structure which resulted:
CREATE TABLE [trace_output] (
[RowNumber] [int] IDENTITY (1, 1) NOT NULL ,
[EventClass] [int] NULL ,
[TextData] [ntext] COLLATE SQL_Latin1_Gene ral_CP1_CS_AS NULL ,
[NTUserName] [nvarchar] (128) COLLATE
SQL_Latin1_Gene ral_CP1_CS_AS NULL ,
[ClientProcessID] [int] NULL ,
[ApplicationName] [nvarchar] (128) COLLATE
SQL_Latin1_Gene ral_CP1_CS_AS NULL ,
[LoginName] [nvarchar] (128) COLLATE
SQL_Latin1_Gene ral_CP1_CS_AS NULL ,
[SPID] [int] NULL ,
[Duration] [bigint] NULL ,
[StartTime] [datetime] NULL ,
[Reads] [bigint] NULL ,
[Writes] [bigint] NULL ,
[CPU] [int] NULL ,
PRIMARY KEY CLUSTERED
(
[RowNumber]
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Seems like you might be able to do something with it.
(Possibly just dumping it straight back out to CSV
or XML if that's easier for you than db querying)
TJG
Thanks for the advice. I did the one that had to be done now by hand.
However, I know I'll need to do more of these in the future, so I'll
try it then.
Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brandon J. Van Every |
last post by:
What's better about Ruby than Python? I'm sure there's something. What is
it?
This is not a troll. I'm language shopping and I want people's answers. I
don't know beans about Ruby or have any preconceived ideas about it. I have
noticed, however, that every programmer I talk to who's aware of Python is
also talking about Ruby. So it seems that Ruby has the potential to compete
with and displace Python. I'm curious on what basis it...
|
by: mike420 |
last post by:
I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro capabilities, unfortunately. I'd like to know if it may
be possible to add a powerful macro system to Python, while
keeping its amazing syntax, and if it could be possible to
add Pythonistic syntax to Lisp or Scheme, while keeping all
of the...
|
by: svilen |
last post by:
hello again.
i'm now into using python instead of another language(s) for
describing structures of data, including names, structure,
type-checks, conversions, value-validations, metadata etc. And i have
things to offer, and to request.
And a lot of ideas, but who needs them....
here's an example (from type_struct.py):
|
by: Lad |
last post by:
Is anyone capable of providing Python advantages over PHP if there are
any?
Cheers,
L.
|
by: Rafal Zawadzki |
last post by:
Hi. I tried earlier to write python zsi mail list, but nobody answered.
I am using ZSI 1.7/2.0rc1 with TTPro Soap SDK. The wsdl file can be found
here:
http://demo.seapine.com/ttsoapcgi.wsdl
My wsdl is the same, only different is the address of the cgi file.
for example i cannot use defectRequest method:
| |
by: Avi Kak |
last post by:
Folks,
Does regular expression processing in Python allow for executable
code to be embedded inside a regular expression?
For example, in Perl the following two statements
$regex = qr/hello(?{print "saw hello\n"})mello(?{print "saw
mello\n"})/;
"jellohellomello" =~ /$regex/;
|
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 402 open ( +6) / 3360 closed ( +6) / 3762 total (+12)
Bugs : 861 open ( -3) / 6114 closed (+27) / 6975 total (+24)
RFE : 228 open ( +2) / 234 closed ( +0) / 462 total ( +2)
New / Reopened Patches
______________________
|
by: Venkat |
last post by:
I am very new to Python. I installed Python in Windows and learning
it. But i need to install Python on Solaris 8 to automate few things
as my build environment is on Solaris. When i tried to download python
2.5 source code and tried to compile i got the error saying
"configure: error: cannot compute sizeof (int), 77".
Between i am also getting parse errors for few files including
siginfo.h
/usr/include/sys/siginfo.h:74: parse error...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |